Git指令速記

Git指令速記 (因為太常忘記了)

git branch

  1. branch: git branch git branch
  2. delete a branch git push origin --delete
  3. local branch to remote: git push -u origin {branch_name}

tag

  1. list tag: git tag

  2. 打tag:

  3. push all tag到remote: git push origin --tags

  4. checkout remote tag: git checkout tags/version {version number}

git checkout

  1. checkout remote branch (new version git):
    git fetch
    git checkout

git revert

// revert code to specific point you want to keep
git reset --hard {hash}

// move branch pointer back to previous HEAD
git reset --soft HEAD@{1}

// remember commit revert change
git commit -m "revert to {hash}"

git rebase

Author

Walile

Posted on

2017-06-22

Updated on

2023-11-23

Licensed under