全局设置
git config --global user.name "zyl"git config --global user.email xxx@xxx.comgit config --list 检查你的git设置git clone xxxxxx.git
添加新的文件
vim demo.txtgit add demo.txt 添加新的文件git commit -m 'this is first commit' 提交到本地仓库,并且设置注释git push 将推送这一转变为主分支git rm xxx.txt 删除文件git commit -m 'xxxx'; 提交到仓库git pushgit pull 拉取文件git log -all 日志git branch 查看所有分支git log --stat xxx 查看 某个支点的提交信息find .git/objects -type f 查看所有分支
阿里云相关命令:
命令行指令
Git 全局设置
git config --global user.name "z1577121881"git config --global user.email "1577121881@qq.com"
创建新版本库
git clone git@code.aliyun.com:z1577121881/tantou.gitcd tantoutouch README.mdgit add README.mdgit commit -m "add README"git push -u origin master
已存在的文件夹或 Git 仓库
cd existing_foldergit initgit remote add origin git@code.aliyun.com:z1577121881/tantou.gitgit add .git commit -am "你需要填写的一些信息"git push -u origin master
码云相关命令
设置全局信息
git config --global user.name "你的名字"git config --global user.email "你的Email"clone 和pushgit clone http://xxxx/xxxx.git
创建特征分支
git checkout -b $feature_name
提交代码
git commit -am "this is commit "
推送到指定分支
git push origin $feature_name
为了方便,最好添加公钥到git.
可以通过下面命令生成
ssh-keygen -t rsa -C "xxxxx@xxxxx.com"# Creates a new ssh key using the provided email# Generating public/private rsa key pair...
查看public key
cat ~/.ssh/id_rsa.pub# ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6eNtGpNGwstc....
添加后,在终端(Terminal)中输入
ssh -T git@git.oschina.net
若返回Welcome to Git@OSC, yourname!
本文来自 git教程 栏目,欢迎学习!
以上就是Git 相关使用命令总结的详细内容,更多请关注24课堂在线网其它相关文章!