Branching Basics
List branches
git branch -a
Create branch
git branch myNewBranch
verify rerunning "git branch -a"
I need to switch to newest branch i created
git checkout myNewBrach
verify rerunning "git branch -a". asterisk move to new branch
run history
git log --oneline --decorate
output would be something like below
ae2314 (HEAD, origin/master, origin/HEAD, myNewBrach, master) Updating..
1. first commit is our last commit
2. HEAD, usually point to last commmit on the current branch
HEAD and origin/HEAD pointers to last commit on local and "remote" respectively
3. master - branch we have been working along - you can test further when you create more branches - what will be here
4. myNewBrach - branch just we created
Note: Since we have not done any changes, all Labels are pointing to same commit
to start the new branch, you need to have unique commits
Rename branch
git branch -m myNewBrach myRenameBranch
verify rerunning "git branch -a"
Delete a branch
git branch -d myRenameBranch
Note: you might have to be outside deleting branch
verify rerunning "git branch -a"
"myRenameBranch" has been removed
No comments:
Post a Comment