首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件开发 >

git运用

2012-12-27 
git使用git addgit diffgit status取消对已修改文件添加的indexgit reset HEAD filename撤销对文件的修改(

git使用
git add
git diff
git status

取消对已修改文件添加的index
    git reset HEAD filename

撤销对文件的修改(还未add to index)
    git checkout filename

对于新添加的文件进行 codereview:
1. 不是用 git add, Untracked files,表明未加入版本控制,git diff 无法检测出来,因此无法 codereview
2. 使用 git add, Changes to be committed,也无法使用 git diff,但稍作修改,即可codereview

codereview时,在git add filename之前,对其审查


修改原文件后,
1. git diff,查看修改内容, 进行 codereview
2. git checkout filenname,还未加index,撤销修改
3. git add filename,将修改的文件加入索引
4. git reset HEAD filename, 取消索引

5. git status
   Changes to be committed  文件已加 index
   Changes not staged for commit   文件未加 index
   Untracked files   未加入本地 repo

6. git commit -a -m ""  将修改内容提交至本地 repo
   或者是,每次修改后, git add filename,修改添加至索引
                   git commit -m ""

7. git push origin master 将本地 repo 提交到远程 repo,即 origin de master分支中
      git push <remote-name> <local branch>:<remote branch>
      本地分支推送更新到远程仓库的指定分支

热点排行