Configuration
git config --global --edit
This will open the .gitconfig file by our default editor. Make changes, save, and close the editor, changes will take place.
To view the changes:
git config --global --list
Branches
List out all branches:
git branch -a
Create new branch:
git branch mynewbranch
switch to new branch:
git checkout mynewbranch
Rename a branch (-m for move, as in mv in bash command):
git branch -m mynewbranch newbranch
Delete a branch:
git branch -d newbranch
Specific branch
git clone a specific branch instead of all the branches and checkout specific one. For example, in my private repo I want to clone the "forth-branch" only, then write:
git clone --single-branch --branch forth-branch https://github.com/machingclee/2020-English-Learning-Website.git
without --single-branch the above will fetch all branches and checkout the forth-branch.
P4Merge Configuration
git config --global merge.tool p4merge
git config --global mergetool.p4merge.path "C:/Program Files/Perforce/p4merge.exe"
git config --global mergetool.prompt false
git config --global diff.tool p4merge
git config --global difftool.p4merge.path "C:/Program Files/Perforce/p4merge.exe"
git config --global difftool.prompt false
and
git config --global --list
to double check the configuration:
core.editor="C:\Users\Ching-Cheong Lee\AppData\Local\Programs\Microsoft VS Code\Code.exe" --wait
user.name=James Lee
user.email=machingclee@gmail.com
color.ui=true
merge.tool=p4merge
mergetool.p4merge.path=C:/Program Files/Perforce/p4merge.exe
mergetool.prompt=false
diff.tool=p4merge
difftool.p4merge.path=C:/Program Files/Perforce/p4merge.exe
difftool.prompt=false
No comments:
Post a Comment