Day 22: Git Zero To Hero ๐Ÿš€

ยท

2 min read


Latest Conflict GIFs | Gfycat

Git Conflict

When u try to make same changes in a file with 2 different branches is known as Git Conflict as the name suggests there is some conflict ๐Ÿ˜„.

Let's say we have created 2 different branches b1 and b2 from master branch.

git checkout -b b1

and then by running the above command we moved into branch b1 and have changed the heading

Then move back to the master branch and create another branch b2

git checkout -b b2

and then by running the above command we moved into branch b2 and changed the heading same changes by b1 which will create a merge conflict

Now, let's merge b1 into b2 by staying in b2

as u can see we are not able to merge because of git conflict.

Dimaag Mein Kuch Aaya Ki Nahi Samaj Mein Aya Kya GIF - Dimaag Mein Kuch Aaya  Ki Nahi Samaj Mein Aya Kya Shantu - Discover & Share GIFs

Resolving Conflicts ...

After failed merge operation git will give us something like this in VS CODE ...

Accept Current changes <<<<<, incoming changes >>>>> or accept both, select any one of these and then do git commit -a -m "merged".

Finally after doing all these have successfully merged b1 into b2.

The above image clarifies all thing .... woalaaaaa ๐Ÿ˜„

Next Blog Teaser ๐Ÿ˜„

Rebase ๐Ÿคฉ

Bye Bye GIF by Reactions | Gfycat

Thanks for reading ๐Ÿ™๐Ÿงก

ย