Branch
Use Git to manage your file version
git branch arguments
git branch
<argument>
git branch --help
Arguments | Description |
---|---|
-v / -vv / --verbose |
Descript the information of the branch |
-a / --all |
Show all the branch |
-d / --delete |
Delete branch |
-D |
Force to delete branch --delete --force |
Change branch
git checkout <branch_name>
Change to specific commit
git checkout bc29f91
Show the current HEAD commit hash
git rev-parse HEAD
git rev-parse --verify HEAD
Show the mapping name of the commit hash
git show-ref
git for-each-ref
Checkout to the remote branch
Git 2.23 or higher version
Fetch all the branchs
git fetch
Show all branches
git branch -v -a
...
remotes/origin/test
Switch to the remote branch and create that branch on the local
git switch test
Git 2.23 earlier version
Fetch all the branchs
git fetch
Show all branches
git branch -v -a
...
remotes/origin/test
Switch to the remote branch and create that branch on the local
git switch -c test origin/test
git checkout -b test origin/test