天天看點

Git reset 和 revert 和 tag 的指令

reset

  • git reset --soft a124df5

    :清除編号為 a124df5 的送出記錄(隻清除 commit)
  • git reset --mixed a124df5

    :預設(–mixed可不加),清除 commit + index 中的資料。
  • git reset --hard a124df5

    :清除 commit + index + workspace 中的資料。
  • git reset HEAD^

    :回退一次,多個

    ^

    就是回退多次。
  • git reset HEAD^^

    :回退兩次。
  • git reset HEAD~1

    :回退 1 次。
  • git reset HEAD~10

    :回退 10 次。
  • git reflog

    :檢視所有的記錄檔,包括 reset 操作。

revert

  • git revert 2a326ad

    :撤銷 2a326ad 這次送出所做的操作,并把本次操作作為一次新的送出。

tag(标簽 / 版本号࿰

繼續閱讀