git使用筆記

2021-08-21 22:23:49 字數 1162 閱讀 2718

將已被track的檔案新增到.gitignore後,以下命令使.gitignore生效,並刪除被遮蔽的檔案。

git rm -r --cached .  #清除快取

git add . #重新trace file

git commit -m "update .gitignore" #提交和注釋

git push origin master #可選,如果需要同步到remote上的話

參考:

建立檔案 ~/.git-credentials

vim ~/.git-credentials
在檔案中寫入

新增git配置

$ git config --global credential.helper store
參考:

git branch -r | grep -v '\->' | while read remote; do git branch --track "$" "$remote"; done

git fetch --all

git pull --all

**:

其它機器從遠端刪除分支後,清理本地儲存的遠端分支資訊:

# 清理遠端分支,把本地不存在的遠端分支刪除

git remote prune origin

# 或git fetch -p

參考2:

git push origin --delete 

git checkout -b local-branchname origin/remote_branchname
# 使用socks5**。macos的客戶端通常為1086埠,其它平台客戶端通常為1080埠。

# 檢視git global配置檔案

git config --global -e

git 使用筆記

git 使用筆記 初始化資訊 git config user.name name git config user.email com git config core.editor vim git init 初始化資訊 從遠端pull git clone git url git pull push 到...

git使用筆記

回滾 git checkout sql 沒有 git add 之前 執行回滾到原始狀態 git reset head sql 執行git add之後,但是沒有 git commit之前 操作,然後在執行 git checkout git remote v 檢視遠端倉庫詳細資訊 git log log...

Git使用筆記

用了一段時間的tortoisgit,基本能滿足目前的需求。但是當切換到linux的工作環境時,就有點不知所措了,於是又複習了一下git的命令,相對於第一次學習,又有了新的認識。工作區 working tree 所有有改動的檔案都存在於工作區。暫存區 index 對於已經存在於工作區的檔案,執行git...