Git 小記

git config --global core.quotepath false  // 解決終端中文亂碼
git push --force-with-lease // 比 force 安全的強(qiáng)行推送

問(wèn)題

fatal: pathspec '.DS_Store' did not match any files

解決辦法

  1. git filter-branch --force --index-filter 'git rm -r --cached --ignore-unmatch .DS_Store' --prune-empty --tag-name-filter cat -- --all
  2. git push -f origin master

參考于: https://stackoverflow.com/questions/25458306/git-rm-fatal-pathspec-did-not-match-any-files/25458504

問(wèn)題:

修改已經(jīng)提交過(guò)的 author 的 name 和 email

解決辦法

git filter-branch --env-filter '

OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"

if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
    export GIT_COMMITTER_NAME="$CORRECT_NAME"
    export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
    export GIT_AUTHOR_NAME="$CORRECT_NAME"
    export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags



git push --force --tags origin 'refs/heads/*'

參考于:https://help.github.com/en/articles/changing-author-info

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 1、Git下載與安裝 https://git-scm.com 選擇對(duì)應(yīng)macOS系統(tǒng)的版本進(jìn)行安裝; 2、Git初...
    燈花微涼閱讀 406評(píng)論 0 5
  • 記錄Git常用的一些操作 初始化倉(cāng)庫(kù) git init 添加文件 git add filename 單個(gè)文件git...
    Tiny_z閱讀 186評(píng)論 0 0
  • error:create branch Fatal: Not a gitflow-enabled repo yet...
    osbornZ閱讀 305評(píng)論 0 0
  • 前言:最初用git時(shí)總結(jié)copy的。 clone代碼: 換行符 中文亂碼 常規(guī)操作: 添加到本地庫(kù) 拉來(lái)其他人的更...
    清晨起床敲代碼閱讀 321評(píng)論 0 0
  • 1、安裝sass01、npm install --save-dev sass-loader//sass-loade...
    丁小凱_eafe閱讀 2,716評(píng)論 0 0

友情鏈接更多精彩內(nèi)容