git installation and common commands

1. Install under windows

1)下载程序安装
2) 	$ git config --global user.name "Your Name"
	$ git config --global user.email "[email protected]"
3)如何生成ssh公钥
(1)你可以按如下命令来生成 sshkey: ssh-keygen -t rsa -C "[email protected]" 三次回车
(2)查看你的 public key,并把他添加到公钥配置里
	cat ~/.ssh/id_rsa.pub

2. Git use

Create branch

1. git checkout -b dev creates and switch branches
2. git push origin dev submits the new branch to the remote warehouse
3. git branch --set-upstream-to=origin/dev pulls the remote branch, but you will find that the prompt is not specified Which branch to merge with cannot be associated with the remote warehouse, so you need to associate first, then pull
git pull

Merge branch
git checkout master first switch to the master branch
git pull origin master If it is developed by multiple people, you need to pull the code on the remote master
git merge dev Then we merge the code of the dev branch to the master
git status and then check the status and Execute the submission command
git push origin master and finally execute the following submission command

Submit code
git pull pull
git add -A to submit local warehouse
git commit -m'your submission remarks'
git push to submit remote warehouse

Other commands
git remote update origin --prune update the list of remote branches
git branch -a view all branches
git checkout -f cancel modification
git push origin --delete Chapater6 delete remote branch Chapater6
git branch -d Chapater6 delete local branch Chapater6

Create a new warehouse from the command line
touch README.md
git init
git add README.md
git commit -m "first commit" git remote add origin (git address)
git push -u origin master
Push the created warehouse
git from the command line remote add origin (git address)
git push -u origin master

Guess you like

Origin blog.csdn.net/eightNine1102/article/details/105968901
Recommended