Skip to content

Instantly share code, notes, and snippets.

@XiaochenCui
Last active September 3, 2017 11:41
Show Gist options
  • Save XiaochenCui/5337922409083d94a9878d61ec1b75af to your computer and use it in GitHub Desktop.
Save XiaochenCui/5337922409083d94a9878d61ec1b75af to your computer and use it in GitHub Desktop.
git cheatsheet

git-cheatsheet

Command

diff

  • git diff

    显示仍留在工作目录中且未暂存的变更

  • git diff --cached

    显示已经暂存因此有助于下次 commit 的变更

branch

  • git push origin --delete <branch_name>

    delete a remote branch

  • git branch -d <branch_name>

    delete a local branch

remove file

  • git rm --cached mylogfile.log

    remove a file from a git repository without deleting it from the local filesystem

  • git rm --cached -r mydirectory

    ibid, but for a directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment