###### tags: `Git` # GIT 指令 * **返回上一個commit** `git reset HEAD^` * **返回指定的commit** `git revert <commit hash>` * **To delete branch remotely** `git push origin --delete remoteBranchName` * **To delete branch locally** `git branch -d localBranchName` * **To see local branches, run this command** `git branch` * **To see remote branches, run this command** `git branch -r` * **To see all local and remote branches, run this command** `git branch -a` * **git delete remote branch error: unable to delete remote ref does not exist** `git fetch -p origin` `git push origin --delete origin/brname` * **git fetch -p origin** 將遠端儲存庫的最新版下載回來,下載的內容包含完整的物件儲存庫(object storage)。 這個命令不包含「合併」分支的動作。 * **查 romote URL** `git remote show origin` * **拉取 remote 分支** `git checkout --track origin/分支`