Git 指令

Commit a local branch to a remote repository

git push [alias] [branch]
  • [alias] : the name of remote repository
  • [branch] : local branch name

Create a local branch to track a remote branch

git checkout --tracked -t [local branch] [remote repository]/[remote branch]

List modified/deleted/untracked files

git status -s

Rescure deleted files from HEAD revision

one deleted file

git checkout [file name]

all deleted file [1]

git ls-files -d | xargs git checkout --

Automatically stage tracked files including deleted files

git add -u

only add deleted files [2]

git ls-files --deleted | xargs git rm

Often used diff command

diff between not staged and committed content

git diff [file name]

diff between staged and committed content

git diff --cached     [file name]
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License