git 状态管理

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了git 状态管理相关的知识,希望对你有一定的参考价值。

git status

 

# deleted: xxx.class

# modified: xxx.xml

查看某个文件的历史,如什么时候被提交上去。

git log file

git log –- xxx.class

直接 git log file 有时会出现下错误

fatal:ambiguous argument unknown revision or path not in the working tree , use –- to separeate paths from revisions

1. 意思是git log 不知道后面是什么参数,因为git log其后面能够带很对象,使用--去指明是使用文件路径

 

删除文件

$ rm a

查看状态

$ git status
On branch test
Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        deleted:    a

添加修改

$ git add .

查看状态

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        deleted:    a

删除提交

$ git commit -m "sync rm a"
[test 150abfb] sync rm a
1 file changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 a

删除操作也要同步,类似于startTeam当中本地删除了,在服务器还有,当同步的时候,会显示miss状态

 

注意:

git add .失败解决办法

使用此方法就OK了
$ git add -A  #或 git add -all

 

 

vim中翻页的命令

整页翻页 ctrl-f ctrl-b
f就是forword b就是backward

翻半页
ctrl-d ctlr-u
d=down u=up

滚一行
ctrl-e ctrl-y

http://www.cnblogs.com/orez88/articles/1867879.html

 

使用nano很方便操作

以上是关于git 状态管理的主要内容,如果未能解决你的问题,请参考以下文章

GitGit 分支管理 ( 克隆远程分支 | 克隆 master 分支 git clone | 查看远程分支 git branch -a | 克隆远程分支 git checkout -b )(代码片段

GitGit 分支管理 ( 克隆远程分支 | 克隆 master 分支 git clone | 查看远程分支 git branch -a | 克隆远程分支 git checkout -b )(代码片段

为啥git管理的代码的状态全部都变成了modified

VSCode自定义代码片段——git命令操作一个完整流程

VSCode自定义代码片段15——git命令操作一个完整流程

VSCode自定义代码片段15——git命令操作一个完整流程