Freezing a Git branch

后端 未结 5 732
悲哀的现实
悲哀的现实 2020-12-29 04:20

Let\'s say I have a develop branch. I create a feature branch from this to develop a feature. Once the feature is developed, it is merged back into develop. Pretty much like

5条回答
  •  旧时难觅i
    2020-12-29 04:56

    I am using the "Git Bash" console to freeze the branch:

    [Solution worked Best during Oct 2018]

    Don't have Git Bash?

    Here is how to install and use the Git Bash console:

    Reference:

    https://github.com/msysgit/msysgit/releases/

    https://help.github.com/articles/set-up-git/

    How to freeze a branch

    git checkout {branch-to-keep-alive}
    git merge --no-ff {branch-to-freeze} 
    

    If git asks for a merge message, type it, then use [Esc] key then type ":wq" command to save and exit.

    You have to go to visual studio and make sure that you can build the solution successfully (with {branch-to-keep-alive}).

    git checkout {branch-to-freeze} 
    
    git tag -a -m "{your-description}" {tag-for-the-branch-to-freeze}
    

    Convention: create the tag like this: {branch-name}_frozen

    git checkout {branch-to-keep-alive}
    
    git branch -d {branch-to-freeze} 
    
    git push --tags origin {branch-to-keep-alive}
    
    git push origin :{branch-to-freeze} 
    

    How to merge a branch with master:

    git checkout {your-working-branch} 
    

    Git merge master

    Open vs and resolve merge conflicts if there is any. Always rebuild the whole things.

    git checkout master
    git merge development
    

    There won't be any conflicts now and everything is set to go.

    Git Bash Console:

提交回复
热议问题