本篇重點
- 如果有尚未提交的變更,無法使用
git rebase
git rebase
合併不會產生額外的合併提交,但是會變更原本的提交 IDgit rebase -i
(互動式 rebase)編輯功能- 使用
git rebase -i
調整提交順序、修改提交訊息、修改提交內容、合併提交、刪除提交 git rebase
的注意事項
git rebase
git rebase
合併不會產生額外的合併提交,但是會變更原本的提交 IDgit rebase -i
(互動式 rebase)編輯功能git rebase -i
調整提交順序、修改提交訊息、修改提交內容、合併提交、刪除提交git rebase
的注意事項【Tool】Unix 時間戳(Unix timestamp) 轉換
Date()
應用【Git】使用 git commit 修改提交(commit)的資訊或是內容
git commit --amend
修改最新一次提交的資訊或是內容git commit --amend --author
修改提交的作者和信箱git commit --amend --reset-author
重置提交的作者和信箱git commit --amend -m
修改提交訊息git commit --amend --no-editor
提交修改但不修改提交訊息git commit --amend
都會變更提交 ID【NPM、GitHub】解決 npm 版本落後 GitHub 版本的問題
git checkout -B
強制更新本地分支git reset --hard
強制更新本地分支git push -f
強制更新遠端分支commit
紀錄commit
紀錄blame
查看檔案的逐行修改紀錄blame
模式下,還原檔案至指定 commit
前的狀態,查看修改前的內容git blame
查看檔案的逐行修改紀錄