您的位置:首页 > 其它

git好用的命令

2017-08-24 08:46 141 查看
公钥设置

1、点击github.com账户的头像上的设置

2、找到ssh key选项

3、title随便起一个,key要讲ssh的~/.ssh中的.pub文件中的内容复制过来

配置全局账户

git config --global user.name zhangsan

配置全局邮箱

git config --global user.email zhangsan@aliyun.com

查看git 全局配置爱

git config --list

克隆服务器版本到指定目录(此目录为c4d目录)

git clone git@github.com:xiaojinyu/c4d.git myc4d

添加test.c文件到暂缓区

git add test.c   

提交test.c到本地暂缓区

git add test.c

提交test.c到本地暂缓区并且进行mark

git add test.c -m "this is commit"

重新检出(恢复到服务器版本)

git checkout test.c

查看本地和远端所有分支

git branch -a

创建本地分支test

git branch test

切换到test分支

git checkout test

创建test分支并切换到新创建的分支test

git checkout -b test

删除test分支

git branch -d test

合并test分支到当前分支

git merge test

将新的test分支发布到github上

git push origin test

从远端删除一个test分支

git push origin:test

显示出所有有差异的文件列表

Git diff
branch1 branch2 --stat   

文件名(带路径)   //显示指定文件的详细差异

Git diff
branch1 branch2 

显示出所有有差异的文件的详细差异

Git diff
branch1 branch2                   

配置push等级为matching simple upstream current nothing ,从左到右安全等级越高

git config --global push.default matching

git版本号查询

git --version

查看历史记录

git log

返回历史版本

git reset <hash序列号>

git帮助查看命令

git help add

此外,还有一些问题

远端创建git仓库命令

merge ,分支管理
http://www.cnblogs.com/videring/articles/6962005.html
git下载权限

公钥和私钥关系
http://yanan0628.iteye.com/blog/2272084
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息