Just a little something for me to remember how to create branches and how to switch over to them.
There are plenty of resources available explaining how to do this, so I just thought I'd write some references down here.
- $ git branch testing
- creates a new branch called testing. Notice that this does not automatically make your new branch the current HEAD.
- $ git log --oneline --decorate
- seeing the branches in your log (as well as tags and the origins. Nice.)
54718edb (HEAD -> master, tag: v2.0.0, origin/master, origin/HEAD, v2.0.1) /* notes here. */
4c8c3bb9 /* moved the entire karchanangular into karchanpersonal. It compiles into the webapp directory. */
bb4bb432 /* upgrade from angular 4 to angular 7 */
12b528ed /* removed old directories that are no longer in use. Clean up. */
ead93fc3 /* changed images table, now has an autogenerated ID, plus an index on the pair owner and url. */ - $ git checkout testing
- switching to a branch
- $ git checkout -b testing
- shorthand for both creating a new branch called testing and checking it out immediately.
- $ git checkout master ; git merge testing
- merges the changes in the testing branch over into the master.
- $ git checkout testing ; git merge master
- merge the changes from your master into your testing branch.
- $ git branch -d testing
- delete a branch
- $ git status
- also shows you what branch you are on.
- $ git show-branch
- shows you all existing branches, and the commit that goes with that point in which it was branched.
References
- GitBook - Git Branching
- https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell
- Git - Branch Manpage
- https://git-scm.com/docs/git-branch
- TutorialsPoint - Git Managing Branches
- https://www.tutorialspoint.com/git/git_managing_branches.htm
No comments:
Post a Comment