git - Why does rebasing unset my current branch and does not complete? -


i'm on branch b4 , "$ git rebase master", gives me conflicts.

 $ git rebase master     first, rewinding head replay work on top of it...     applying: rebase: modified 1.txt     using index info reconstruct base tree...     m       1.txt     falling patching base , 3-way merge...     auto-merging 1.txt     conflict (content): merge conflict in 1.txt     failed merge in changes.     patch failed @ 0001 rebase: modified 1.txt     copy of patch failed found in:        c:/hands_on/github/learn_git/cmd/.git/rebase-apply/patch      when have resolved problem, run "git rebase --continue".     if prefer skip patch, run "git rebase --skip" instead.     check out original branch , stop rebasing, run "git rebase --abort". 

here, shows i'm no longer on branch b4.

 $ git status     # not on branch.     # rebasing.     #   (fix conflicts , run "git rebase --continue")     #   (use "git rebase --skip" skip patch)     #   (use "git rebase --abort" check out original branch)     #     # unmerged paths:     #   (use "git reset head <file>..." unstage)     #   (use "git add <file>..." mark resolution)     #     #       both modified:      1.txt     #     no changes added commit (use "git add" and/or "git commit -a") 

i fixed conflicts , committed changes:

$ vim 1.txt  $ git commit -a -m "fixed rebase conflict" [detached head 2cb2672] fixed rebase conflict  1 file changed, 1 insertion(+)  $ git status # not on branch. # rebasing. #   (all conflicts fixed: run "git rebase --continue") # nothing commit, working directory clean 

but when tried "--continue", not complete rebase, instead giving me more "instructions". why?

$ git rebase --continue applying: rebase: modified 1.txt no changes - did forget use 'git add'? if there nothing left stage, chances else introduced same changes; might want skip patch.  when have resolved problem, run "git rebase --continue". if prefer skip patch, run "git rebase --skip" instead. check out original branch , stop rebasing, run "git rebase --abort". 

i fixed conflicts , committed changes:

that's went wrong. git rebase --continue expects changes in index, not yet committed. since committed changes, git rebase's own attempt fails, because there no changes left committed.

you should able undo commit action, without resetting index, running git reset --soft @^. , git rebase --continue should work after that.

you alternatively use git rebase --skip bypass git rebase's own attempt commit changes, risks bit more getting messed up: own commit not have respected original commit's author name, email , time.

the fact git status shows you're not on branch not problem. git rebase intentionally detaches current branch until operation finishes. fixed after operations have succeeded.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -