This week I continued learning Git by practicing creating branches and merging them back to main.
In my Static Site Generatorstatic-dodo, I added two new issues, one toAdd support for inline code blocks and the other toAdd support for a horizontal rule in Markdown.
Instead of working on these issues in the main branch one by one, I created a branch for each and started working on these inparallel. After adding the necessary code to both branches, I decided to usegit merge
to merge both back into main.
git merge issue-13 main
The first one was an easyfast-forward merge. This means that theHEAD of main is simply moved to the latestcommit in issue-13.
git merge issue-14 main
This second one created aconflict. The reason is that on the same line where I added code for issue 13, I also wrote code for issue 14.
Git in this case put it all together while adding these helpful lines to the file:
<<<<<<< HEADLine from main branch=======Line from issue-14 branch>>>>>>> issue-14
This time all I wanted to do was to keep both lines, so I simply deleted the<<<<<<<
,=======
,>>>>>>>
lines. Here is the mergecommit.
This was a simple exercise but it made me realize how powerful Git can be and I still feel like I have only scratched the surface of it. I am now getting ready to startHacktoberfest and I hope to find some good projects to contribute to!
Top comments(0)
For further actions, you may consider blocking this person and/orreporting abuse