vishavjeet

singh.vishavjeet11@gmail.com

Git Branching - Basic Branching and Merging

Posted on February 25, 2021



>git checkout -b iss53


Switched to a new branch "iss53"


This is shorthand for:


>git branch iss53


>git checkout iss53


>vim index.html


>git commit -a -m 'Create new footer]'


>git checkout master


Switched to branch 'master'


>git checkout -b hotfix


Switched to a new branch 'hotfix'


>vim index.html


>git commit -a -m 'Fix broken email address'


[hotfix 1fb7853] Fix broken email address


1 file changed, 2 insertions(+)


>git checkout master


>git merge hotfix


Updating f42c576..3a0874c


Fast-forward


index.html | 2 ++


1 file changed, 2 insertions(+)


>git branch -d hotfix


Deleted branch hotfix (3a0874c).


>git checkout iss53


Switched to branch "iss53"


>vim index.html


>git commit -a -m 'Finish the new footer'


[iss53 ad82d7a] Finish the new footer


1 file changed, 1 insertion(+)


Basic Merging


>git checkout master


Switched to branch 'master'


>git merge iss53


Merge made by the 'recursive' strategy.


index.html | 1 +


1 file changed, 1 insertion(+)


Now that your work is merged in, you have no further need for the iss53 branch. You can close the issue in your issue-tracking system, and delete the branch:


esc :wq


git push -u origin new-features


Create pr


i got conflic


>git pull origin master


incase of complext conflict


Step 1: From your project repository, bring in the changes and test.


>git fetch origin


>git checkout -b seller-module origin/seller-module


>git merge master


Step 2: Merge the changes and update on GitHub.


>git checkout master


>git merge --no-ff seller-module


>git push origin master


Sign In for comment and like the post.