Last active
August 29, 2015 14:24
-
-
Save Ajwah/0ed36d845de3f001533d to your computer and use it in GitHub Desktop.
[Git] Move Recent Commits To New Branch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git log --> obtain commit id | |
git branch newbranch | |
git reset --hard a1b2c3d4 | |
(git checkout newbranch) if need be | |
http://stackoverflow.com/questions/1628563/move-the-most-recent-commits-to-a-new-branch-with-git | |
Two push issues: | |
1) On master when doing push you get following error: | |
hint: Updates were rejected because the tip of your current branch is behind | |
hint: its remote counterpart. Integrate the remote changes (e.g. | |
hint: 'git pull ...') before pushing again. | |
2) When going to newbranch to do a push you get following error: | |
fatal: The current branch newbranch has no upstream branch. | |
To push the current branch and set the remote as upstream, use | |
git push --set-upstream origin newbranch | |
Resolving 2 is easy as solution is printed: git push --set-upstream origin newbranch | |
Resolving 1 can be done by forcing the push with -f parameter: git push -f origin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment