Git使用筆記

2021-09-07 14:32:03 字數 1111 閱讀 6277

1:檢視git分支

git branch -a

2:建立本地分支

git branch 分支名

3:推送分支到遠端

git push origin 分支名

4:刪除分支

git branch -d 本地分支名 :刪除本地分支

git push origin --delete 遠端分支名 :刪除遠端分支

5:重新命名分支

git branch -m 原分支名 新分支名

6:切換分支

git checkout 分支名

7:拉取分支

git pull origin 分支名

使用git進行團隊合作:

1:各自新建分支,在各自分支程式設計,程式設計完畢後:

1

:新增當前資料夾下所有檔案到git本地倉庫

git add .

2:提交,新增提交備註

git commit -m "

備註資訊"3

:推送到遠端

git push

2:有乙個develop分支,一人專門負責合併各分支內容到develop分支,處理好衝突後推送到遠端develop分支

1

:切換到develop分支

git checkout develop

2:拉取其他分支內容

git pull origin 其他分支名

3:處理**衝突

從**報錯處,處理好衝突

4:推送develop到遠端分支

git add .

git commit -m '

備註資訊

'git push

3:其他人從develop拉取內容到本地,再次處理衝突,使得內容與develop上的一致。至此,團隊所有人的工作合併完成

1

:git checkout 自己的分支名

2:git pull origin develop

3:處理衝突,使本地內容與develop一致

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...