Git常用命令

  • 查看本地分支git状态

  $ git status

  • 把对某个文件的修改添加到下次提交中

  $ git add

  • 提交本地的国有修改

  $ git add -p<file>

  • 提交之前已标记的变化

  $ git commit -a

  • 附加提交消息

  $ git commit

  • 显示所有提交(仅显示提交的hash和message)

  $ git log

  • 列出所有的分支

  $ git branch

  • 切换分支

  $ git checkout <branchName>

  • 显示远端的信息

  $ git remote -v

  • 现在远端版本,并自动与head版本合并

  $ git fetch <remote>

  • 更新代码

  $ git pull

  • 同步到远程

  $ git push

  • 暂存当前正在进行的工作, 比如想pull 最新代码, 又不想加新commit

  $ git stash

  • 释放暂存

  $ git stash pop

posted @ 2017-07-30 14:26  chachanode  阅读(50)  评论(0编辑  收藏  举报