githubmergegitbox

Need guidance in Github merge


I am new to managing code revisions and need guidance on how to merge to code sets. I have a MASTER branch with my latest UI and I have a branch called "Feature-A" with lots of Django additions + template additions to the previous UI files.

Since I am new to Github, I want to take the safest approach incase I need to revert mistakes. Should I make a new brach of master and merge Feature-A into that branch or should I merge Feature-A directly into the MASTER?


Solution

  • Since you're new, I would say the best approach would be to create another branch (clone of master branch) and then merge feature A into that, and see if it works. If not, keep testing feature A to make it compatible. If it works, great! Just remove that extra branch and merge feature A into the master.

    I.e.,
    git checkout master
    Then, create a new branch (git checkout -b 'featuretest')
    Now, git branch shows
    * master
    * featureA
    * featuretest

    Then, do git checkout featuretest, and git merge featureA to merge it.

    If the feature works, great! Remove the branch (git checkout master; git branch -d featuretest) and do it for real (git merge featureA)

    If the feature doesn't work, go back to the feature branch (git checkout feature) and keep testing.