git操作命令整理
2016-06-24 10:32
344 查看
1、mkdir(创建目录)
2、pwd(用户显示当前目录)
3、git init(把该目录变成Git可以管理的仓库)
4、ls -ah(列出该目录下的所有文件)
5、git add <file-path>(把文件添加到仓库)
6、git reset <file-path>(取消添加的新文件)
7、git rm <file-path>(从git删除文件,不再repo里管理)
8、git diff(查看本地未确认的修改)
9、git diff --cached(查看本地已确认但未提交的修改)
10、git status(查看本地修改的文件状态)
11、git commit -m "short commit message"(本地提交,生成一个版本)
12、git log(查看提交记录)
13、git checkout --<file-path>(撤销一个文件的修改)
14、git checkout --(撤销当前目录的所有修改)
15、git branch <new branch>(创建分支,基于当前分支)
16、git branch <new-branch> <base-branch>(基于某个分支创建分支)
17、git checkout <branch>(切换分支)
18、git checkout -b <new-branch> [base-branch](创建新分支并立即切过去)\
19、git merge <other-branch>(合并一个分支到当前分支)
20、git branch -d <branch>(安全删除(已经合并过的)本地分支)
21、git branch --set-upstream develop origin/develop((已存在的)本地分支关联到服务器分支)
22、git pull(获取服务器(所有的)更新,并合并当前远程分支的更新)
23、git pull origin <branch>(获取某个远程分支的更新(到当前分支!!))\
24、git fetch [origin [<remote-branch-name>]](仅拉取服务器更新,但不合并或 rebase)
25、git push origin <branch>(向服务器提交更新(首先你的本地分支已经关联了远程分支))
26、git push origin --delete <remote-branch>(删除服务器远程分支)
27、git tag <tag-name> <branch-or-revision>(创建一个标签)
28、git push --tags(提交标签到服务器)
2、pwd(用户显示当前目录)
3、git init(把该目录变成Git可以管理的仓库)
4、ls -ah(列出该目录下的所有文件)
5、git add <file-path>(把文件添加到仓库)
6、git reset <file-path>(取消添加的新文件)
7、git rm <file-path>(从git删除文件,不再repo里管理)
8、git diff(查看本地未确认的修改)
9、git diff --cached(查看本地已确认但未提交的修改)
10、git status(查看本地修改的文件状态)
11、git commit -m "short commit message"(本地提交,生成一个版本)
12、git log(查看提交记录)
13、git checkout --<file-path>(撤销一个文件的修改)
14、git checkout --(撤销当前目录的所有修改)
15、git branch <new branch>(创建分支,基于当前分支)
16、git branch <new-branch> <base-branch>(基于某个分支创建分支)
17、git checkout <branch>(切换分支)
18、git checkout -b <new-branch> [base-branch](创建新分支并立即切过去)\
19、git merge <other-branch>(合并一个分支到当前分支)
20、git branch -d <branch>(安全删除(已经合并过的)本地分支)
21、git branch --set-upstream develop origin/develop((已存在的)本地分支关联到服务器分支)
22、git pull(获取服务器(所有的)更新,并合并当前远程分支的更新)
23、git pull origin <branch>(获取某个远程分支的更新(到当前分支!!))\
24、git fetch [origin [<remote-branch-name>]](仅拉取服务器更新,但不合并或 rebase)
25、git push origin <branch>(向服务器提交更新(首先你的本地分支已经关联了远程分支))
26、git push origin --delete <remote-branch>(删除服务器远程分支)
27、git tag <tag-name> <branch-or-revision>(创建一个标签)
28、git push --tags(提交标签到服务器)
相关文章推荐
- RPC failed; result=22, HTTP code = 411
- git更新已經刪除的文件
- 提取Git每次提交后Commit的文件
- GIT迁移服务器
- 分布式版本管理git入门指南使用资料汇总及文章推荐
- git终极指南:在实际开发中的应用
- Git远程操作详解
- 25个 Git 进阶技巧(翻译)
- 详解版本控制利器Git,SVN的异同以及适用范围
- Ruby实现的删除已经合并的git分支脚本分享
- 在 Shell 提示符中显示 Git 分支名称的方法
- Git使用基础篇(一些常用命令和原理)
- git eclipse 插件的安装
- git fork同步是什么意思?
- Git使用小坑 Out of memory错误的解决方法
- Python的高级Git库 Gittle
- 使用GIT进行源码管理――GUI客户端小结
- 使用git代替FTP部署代码到服务器的例子
- linux系统安装git及git常用命令
- 分享下自己总结的Git常用命令