git

一,代碼合併流程,以newljtc合併爲示例
1、git checkout uat


2、如果本地已存在newljtc分支,則
  git pull origin newljtc
否則
  git fetch origin newljtc:newljtc


3 git checkout newljtc


4  gitk(查看newljtc分支提交的內容)


6  git checkout uat (切換到uat分支)
7  git merge newljtc(合併newljtc到prod分支)


8、如果要合併多個分支、重複2-7步驟


二、保證remote uat分支與 reomte master代碼同步
9、git push origin uat  (合併完所有分支後push prod至remote)
10 git checkout master
11 git merge uat(合併uat到master分支)
12、git push origin master(push master至remote)


三、版本合併時異常(比如合錯分支,或者合併的分支有多提交的代碼)如何解決:比如test1分支存在問題,想回退
1、git checkout prod (切換到prod分支)
1、git tag(查看是否有tag)
2、 git tag tag1(設置tag)
3、 git tag(查看tag是否設置成功)
4、 git merge test1(把test1分支合併到prod分支)
5、 gitk


(6、 git checkout tag1
7、 git status
8、 git push origin master
9、 git commit
10、git log -1)


11、git reset  tagID(回退到標籤)
(12、git stash
13、git reset --hard)












  git fetch origin bugs-fixed:bugs-fixed


  git fetch origin 1605061906:1605061906


----------------
版本文件回退相關命令
git checkout – file 


a. git reset –-hard HEAD^,如果退回到上上個版本只需把HEAD^改成HEAD^^,以此類推;git reset –hard HEAD~100即爲退回到前100個版本。
b. git reset –hard 版本號;







發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章