git常用命令
2015-08-30 22:26
288 查看
1.设置英文版的git
echo "alias git='LANG=en_GB git'" >> ~/.bashrc
重启
设置中文版
加个# echo "#alias git='LANG=en_GB git'" >> ~/.bashrc
2.git init
初始化git
3.git config
配置git,用户名,邮箱等等
4.git add "file"
添加文件
5.git commit -m "commit"
添加注释
6.git status
查看当前状态
7.git log
查看日志
8.git reset --hard commit_id
回到某一个特定的版本,commit_id版本号,HEAD当前版本
HEAD^前一个版本
9.git reflog
查看设置日志
10.git diff
查看尚未提交的变化
11.git remote add origin http://....../....git 与远端服务器相关联
12.git push -u origin master
推送到远端服务器
13.git clone http://...... .git
从远端服务器复制一个git项目。
14.ssh-keygen -t rsa -C "alants56@163.com"
生成两个文件id_rsa 和 id_rsa.pub,其中id_rsa为私钥,
id_rsa.pub为公钥。
15.git branch branch_name
创建分支
git branch [-a -r -v]
查看分支
git branch -d branch_name
删除分支
git branch -D branch_name
强制删除分支
16.git checkout branch_name
切换分支
git checkout -b branch_name
创建分支并切换分支
17.git merge branch_name
将分支合并到当前分支
git merge --no-ff -m "merge" branch_name
将分支合并,禁用Fast forward模式
18.git stash
隐藏当前的现场
git stash list
查看隐藏的现场
git stash apply
恢复现场(但不删除stash内容)
git stash drop
删除
git stash pop
恢复并删除stash
19.git log --graph [--pertty=oneline --abbrev-commit]
查看分支的合并情况
20.git remote [-v]
查看远程库
21.git push origin branch_name
推送branch_name到远程仓库
22.git checkout -b branch_name origin/branch_name
创建远程分支
23.git branch --set-upstream branch_name origin/branch_name
本地branch_name与远程的branch_name连接
24.git pull
抓取远程分支的最新的提交
25.git tag tag_name
打标签
git tag
查看标签
git tag -a tag_name -m "tag_info"
指定标签信息
git tag -s tag_name -m "tag_sig"
使用PGP签名标签
26.git show tag_name
查看标签信息
27.git push origin tag_name
推送一个本地标签
git push origin --tags
推送全部未推送的本地标签
28.git tag -d tag_name
删除一个本地标签
git push origin :refs/tags/tag_name
删除一个远程的标签
echo "alias git='LANG=en_GB git'" >> ~/.bashrc
重启
设置中文版
加个# echo "#alias git='LANG=en_GB git'" >> ~/.bashrc
2.git init
初始化git
3.git config
配置git,用户名,邮箱等等
4.git add "file"
添加文件
5.git commit -m "commit"
添加注释
6.git status
查看当前状态
7.git log
查看日志
8.git reset --hard commit_id
回到某一个特定的版本,commit_id版本号,HEAD当前版本
HEAD^前一个版本
9.git reflog
查看设置日志
10.git diff
查看尚未提交的变化
11.git remote add origin http://....../....git 与远端服务器相关联
12.git push -u origin master
推送到远端服务器
13.git clone http://...... .git
从远端服务器复制一个git项目。
14.ssh-keygen -t rsa -C "alants56@163.com"
生成两个文件id_rsa 和 id_rsa.pub,其中id_rsa为私钥,
id_rsa.pub为公钥。
15.git branch branch_name
创建分支
git branch [-a -r -v]
查看分支
git branch -d branch_name
删除分支
git branch -D branch_name
强制删除分支
16.git checkout branch_name
切换分支
git checkout -b branch_name
创建分支并切换分支
17.git merge branch_name
将分支合并到当前分支
git merge --no-ff -m "merge" branch_name
将分支合并,禁用Fast forward模式
18.git stash
隐藏当前的现场
git stash list
查看隐藏的现场
git stash apply
恢复现场(但不删除stash内容)
git stash drop
删除
git stash pop
恢复并删除stash
19.git log --graph [--pertty=oneline --abbrev-commit]
查看分支的合并情况
20.git remote [-v]
查看远程库
21.git push origin branch_name
推送branch_name到远程仓库
22.git checkout -b branch_name origin/branch_name
创建远程分支
23.git branch --set-upstream branch_name origin/branch_name
本地branch_name与远程的branch_name连接
24.git pull
抓取远程分支的最新的提交
25.git tag tag_name
打标签
git tag
查看标签
git tag -a tag_name -m "tag_info"
指定标签信息
git tag -s tag_name -m "tag_sig"
使用PGP签名标签
26.git show tag_name
查看标签信息
27.git push origin tag_name
推送一个本地标签
git push origin --tags
推送全部未推送的本地标签
28.git tag -d tag_name
删除一个本地标签
git push origin :refs/tags/tag_name
删除一个远程的标签
相关文章推荐
- 生成微信公众号关注二维码
- Oracle中关联表的视图创建
- hibernate 5.0中如何使用SchemaExport
- 《明明白白去看牙》:北大口腔医院的一群中青年医生写的牙的保健与治疗的科普,五星推荐
- Heap和Stack的区别
- 在WebBrowser中注入并执行javascript代码
- Mac 根目录文件夹,总共17个
- Linux之scp报错两例
- 单链表的基本操作(3):求并与反转
- mindmanager快捷键
- 正则表达式基本用法
- Xcode cannot run using the selected device.
- 2015年终总结(一)
- 5. Longest Palindromic Substring
- ubuntu14.04重启网卡不生效
- Netty5入门程序结构说明
- Python爬虫学习记录(3)——用Python获取虾米加心歌曲,并获取MP3下载地址
- 分布式架构的演进
- [树形DP]VK Cup 2012 Round 1 D. Distance in Tree
- 3、CC2541芯片中级教程-OSAL操作系统(ADC光敏电阻和修改串口波特率)