Home > Article > Development Tools > Summary of Git related commands
Global settings
git config --global user.name "zyl" git config --global user.email xxx@xxx.com git config --list 检查你的git设置 git clone xxxxxx.git
Add new file
vim demo.txt git add demo.txt 添加新的文件 git commit -m 'this is first commit' 提交到本地仓库,并且设置注释 git push 将推送这一转变为主分支 git rm xxx.txt 删除文件 git commit -m 'xxxx'; 提交到仓库 git push git pull 拉取文件 git log -all 日志 git branch 查看所有分支 git log --stat xxx 查看 某个支点的提交信息 find .git/objects -type f 查看所有分支
Alibaba Cloud related Command:
Command line command
Git global settings
git config --global user.name "z1577121881" git config --global user.email "1577121881@qq.com"
Create a new version library
git clone git@code.aliyun.com:z1577121881/tantou.git cd tantou touch README.md git add README.md git commit -m "add README" git push -u origin master
Existing folder or Git repository
cd existing_folder git init git remote add origin git@code.aliyun.com:z1577121881/tantou.git git add . git commit -am "你需要填写的一些信息" git push -u origin master
Code cloud related commands
Set global information
git config --global user.name "你的名字" git config --global user.email "你的Email" clone 和push git clone http://xxxx/xxxx.git
Create feature branch
git checkout -b $feature_name
Submit code
git commit -am "this is commit "
Push to the specified branch
git push origin $feature_name
For convenience, it is best to add the public key to git.
You can generate it through the following command
ssh-keygen -t rsa -C "xxxxx@xxxxx.com"# Creates a new ssh key using the provided email # Generating public/private rsa key pair...
View the public key
cat ~/.ssh/id_rsa.pub # ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6eNtGpNGwstc....
After adding, enter
ssh -T git@git.oschina.net
in the Terminal to return Welcome to Git@OSC, yourname!
This article comes from the git tutorial column, welcome to learn!
The above is the detailed content of Summary of Git related commands. For more information, please follow other related articles on the PHP Chinese website!