Timeline for Git: "Not currently on any branch." Is there an easy way to get back on a branch, while keeping the changes?
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 15, 2022 at 7:11 | comment | added | defend orca | use 'rebase' replace 'merge' is a good work | |
Mar 3, 2021 at 13:34 | comment | added | Hartmut Pfarr | me helped this stackoverflow.com/questions/7124486/… | |
Feb 22, 2019 at 22:18 | comment | added | Monica Heddneck | I don't understand how you can be not on a branch in the first place. Git is so bizarre. | |
Feb 23, 2017 at 6:58 | history | edited | theheadofabroom | CC BY-SA 3.0 |
added 399 characters in body; deleted 2 characters in body
|
Jan 30, 2014 at 23:42 | comment | added | Craig McQueen | This is risky in case you end up with merge conflicts, and you are a git beginner. I'd prefer babay's answer, because making a branch of your current point is a good first step to keep track of where your code is. | |
Jul 8, 2013 at 13:38 | comment | added | Erik B |
@thinkanotherone If you have committed your changes already there would be nothing to stash and checking out a different branch is not the end of the world. The commit you just made is still there and you can merge it to that branch by using git merge <hash-of-the-commit-you-just-made> .
|
|
Dec 21, 2012 at 18:13 | comment | added | thinkanotherone | BE REALLY CAREFUL. IF YOU HAVE COMMITTED THE CHANGE and you follow these steps...You will see the message..."Your branch and origin/master have diverged". | |
May 31, 2012 at 13:31 | comment | added | Daniel |
If committed, get hash of last commit. Checkout the branch you wish to be at, and git merge _hash_
|
|
May 18, 2012 at 9:35 | comment | added | araqnid |
if you've already committed: note the hash of the commit you made (use git show or git rev-parse HEAD ), switch to the branch and then git cherry-pick followed by the commit hash.
|
|
Jan 19, 2011 at 13:23 | vote | accept | Erik B | ||
Jan 19, 2011 at 13:08 | history | answered | araqnid | CC BY-SA 2.5 |