Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"force" git commit on local to external via push? [duplicate]

Tags:

git

Possible Duplicate:
Github first push problem… how to merge remote changes?

My external repo is fairly outdated. I want to push all my local changes up stream. However, when I attempt to do so I get the following message...

error: failed to push some refs to 'ssh://mylink'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.

I don't want to pull because if I do those external changes will mess up my local changes. How do I override the external?

like image 849
Skizit Avatar asked May 15 '11 14:05

Skizit


People also ask

How do I push a cloned repository?

Navigate to the repository you just cloned. Pull in the repository's Git Large File Storage objects. Mirror-push to the new repository. Push the repository's Git Large File Storage objects to your mirror.

How do I force push amended commit?

Amended force pushThe --force option must be used to push an amended commit. The above example assumes it is being executed on an existing repository with a commit history. git commit --amend is used to update the previous commit. The amended commit is then force pushed using the --force option.

Can I copy a commit from one repo to another?

Yes, by adding a remote and cherry-picking the commits on top of your first commit. The rest of this answer is if you still want to add the LICENSE to your previous repo. Yes. You can place your LICENSE commit as the first commit by rebasing.

What happens if two people push to git at the same time?

If server detects a conflict when someone pushes data (and if two users are doing this "simultaneously" one of the pushes will be conflicting, because it will be applied only after the other one completes), the server will reject it, and the unlucky user shall then resolve conflicts and try to push again.


1 Answers

git push --force remoterepository

like image 107
LaC Avatar answered Nov 15 '22 10:11

LaC