On Thu, 14 Nov 2013 03:44:56 -0800 (PST)
Diogo Machado <di...@diogomachado.com> wrote:

> Hi, I'm necessity rollback 2 commits, I try:
> git reset --hard HEAD~2
> Now, how can I synchronize with my remote repository?

Depends on how do you specify "synchronize".

Do you want to send the updated contents of your local branch to update
(overwrite) some branch in a remote repository?
If yes, do

git push -f <remote> localbranch:remotebranch


git push <remote> +localbranch:remotebranch

or just one of

git push -f <remote> localbranch
git push <remote> +localbranch

if the name to update/overwrite in the remote repository is the same as
in the local one.

The idea is that the "-f" command-line option ("--force" is its full
name) forces updating.  A "+" sign before the so-called refspec --
the specification of what to update with what means the same thing: to
force the update.

Forcing is needed because by default Git forbirds updating a branch with
the history if the new history does not wholly contain the old one.
In case you chopped off a number of commits falls into the same class
of scenario: the new history graph is not a strict superset of the old

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to