git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* more git weirdness (git rebase, merge conflicts
@ 2013-03-27 18:51 J.V.
  2013-03-28 16:04 ` Magnus Bäck
  0 siblings, 1 reply; 2+ messages in thread
From: J.V. @ 2013-03-27 18:51 UTC (permalink / raw)
  To: git@vger.kernel.org

I have a local/development branch tracked to origin/development.  I made 
no changes to local/dev and did a git pull with rebase, I did not expect 
any conflicts.

I got a conflict and was thrown onto another branch.  I attempted a 
merge (using IntelliJ) accepting everything from the server but a 
variable definition was missing for some odd reason and the merge was 
not successful (merge was resolved but the file would not compile) so I 
decided to simply go back to my dev branch and figure out how to do a 
git pull -f (force overwrite of all local files so that I could get my 
local/dev back into sync with origin/dev.

On my screwed up branch that I was thrust onto:
I typed:
     $git rebase --skip            <= I was stuck in a rebase (rebase 
failed, was thrown onto a tmp branch and thought this would get me out 
of there)

Now I have been sitting here for an hour watching  "Applying: <message" 
scroll by and it looks like the messages are going backwards into the 
past one by one.  What the hell is happening?

     Applying: add log information
     Applying: <previous message
     .... and it goes on and on and on.

All I want to do at this point is to get back to my dev branch and force 
pull from origin/dev while keeping all local files that have not been 
added to my local repo.

How do I stop this madness and get back to local dev and force pull from 
origin/dev     <= which is our master.

Any help would be greatly appreciated.


thanks


J.V.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: more git weirdness (git rebase, merge conflicts
  2013-03-27 18:51 more git weirdness (git rebase, merge conflicts J.V.
@ 2013-03-28 16:04 ` Magnus Bäck
  0 siblings, 0 replies; 2+ messages in thread
From: Magnus Bäck @ 2013-03-28 16:04 UTC (permalink / raw)
  To: J.V.; +Cc: git

On Wednesday, March 27, 2013 at 14:51 EDT,
     "J.V." <jvsrvcs@gmail.com> wrote:

> I have a local/development branch tracked to origin/development.  I
> made no changes to local/dev and did a git pull with rebase, I did
> not expect any conflicts.
> 
> I got a conflict and was thrown onto another branch.  I attempted a
> merge (using IntelliJ) accepting everything from the server but a
> variable definition was missing for some odd reason and the merge
> was not successful (merge was resolved but the file would not
> compile) so I decided to simply go back to my dev branch and figure
> out how to do a git pull -f (force overwrite of all local files so
> that I could get my local/dev back into sync with origin/dev.
> 
> On my screwed up branch that I was thrust onto:
> I typed:
>     $git rebase --skip            <= I was stuck in a rebase (rebase
> failed, was thrown onto a tmp branch and thought this would get me
> out of there)

The --skip option makes Git skip one commit in the rebase. To bail out
completely and restore the original state, use --abort.

> Now I have been sitting here for an hour watching  "Applying:
> <message" scroll by and it looks like the messages are going
> backwards into the past one by one.  What the hell is happening?
> 
>     Applying: add log information
>     Applying: <previous message
>     .... and it goes on and on and on.

You initated a rebase with an incorrect base, so Git is rebasing all
past history onto a new base. Say the upstream repository looks like
this, with uppercase letters denoting commits found on the upstream
and lowercase letters being your local commits (if any):

           ----------C
          /
     A----B---
              \
               ------------D----E
                           \
                            --a--b

In this example, you've made two commits since you started working on
commit D. The expected result for a rebase is for Git to rebase the two
commits you've made since D (a, b) and put them on top of E, the new
baseline fetched from the upstream. However, because of how you invoke
the rebase, Git actually thinks that C is the base of your local branch
and computes all the commits you've made since C and finds all commits
between B and b, which it now tries to rebase on top of C.

> All I want to do at this point is to get back to my dev branch and
> force pull from origin/dev while keeping all local files that have
> not been added to my local repo.
> 
> How do I stop this madness and get back to local dev and force pull
> from origin/dev     <= which is our master.

Start with "git rebase --abort" to get out of the rebase loop. To delete
all your local uncommitted changes made to tracked files while keeping
local/untracked files, run "git reset --hard". If you haven't made any
local commits a correctly invoked rebase (or pull) will be a trivial
fast-forward.

-- 
Magnus Bäck
baeck@google.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-28 16:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-27 18:51 more git weirdness (git rebase, merge conflicts J.V.
2013-03-28 16:04 ` Magnus Bäck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).