git

git rm – remove the file or directory on the git repo

1
2
3
4
5
6
7
8
9
10
11
12
13
# -f, --force
# Override the up-to-date check.
# -n, --dry-run
# Don't actually remove any file(s). Instead, just show if they exist in the index and would otherwise be
# removed by the command.
# -r
# Allow recursive removal when a leading directory name is given.
$ git rm -r -n --cache protected/components/Util.php
$ git rm -r -n --cache protected/*
$ git rm -r -n --cache protected

git push – push local branch to remote branch

1
# git push origin local_branch:remote_branch

git fetch

  • git fetch →→ 这将更新git remote 中所有的远程repo 所包含分支的最新commit-id, 将其记录到.git/FETCH_HEAD文件中

  • git fetch remote_repo →→ 这将更新名称为remote_repo 的远程repo上的所有branch的最新commit-id,将其记录。

  • git fetch remote_repo remote_branch_name →→ 这将这将更新名称为remote_repo 的远程repo上的分支: remote_branch_name

  • git fetch remote_repo remote_branch_name:local_branch_name →→ 这将这将更新名称为remote_repo 的远程repo上的分支: remote_branch_name ,并在本地创建local_branch_name 本地分支保存远端分支的所有数据。

  • FETCH_HEAD: 是一个版本链接,记录在本地的一个文件中,指向着目前已经从远程仓库取下来的分支的末端版本

参考:

http://www.xuebuyuan.com/2071482.html