Common git commands + terminal commands

Common git commands

git pull origin 分支 

Pull the specified branch to the local branch

 git branch -a

View all remote branches

git checkout 本地分支

Switch local branch

git log

View local submission records

git clone 仓库地址/ssh

Clone instruction

git reset --hard 1d323c

Roll back to a certain commit point. Roll back the remote branch locally. If you need to roll back, just forcibly overwrite it, just git push

origin 远程分支名  --force
git branch -d 分支名

Delete local branch

git push origin --delete 远程分支名
git branch -dr 远程分支名

Delete remote branch

git branch -a

List all local branches and remote branches

git checkout  分支名

Switch to branch and update local files

git fetch

Update local branch

git merge 分支名

Merge the specified branch to the current branch

Terminal command

View key 5

cat ~/.ssh/id_rsa.pub

Display the path of the current directory

pwd

Configure username and email

git config --global user.name "username"
git config --global user.email [email protected]

View username and email

git config user.name 
git config user.email

View other configuration information (git settings list)

git config --list

Guess you like

Origin blog.csdn.net/t5_5_5_5_5_7_7/article/details/115001797