<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: adikejre</title>
    <description>The latest articles on Forem by adikejre (@adikejre).</description>
    <link>https://forem.com/adikejre</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1058943%2F9365dc63-3218-4df3-9845-60fffcabc34c.png</url>
      <title>Forem: adikejre</title>
      <link>https://forem.com/adikejre</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/adikejre"/>
    <language>en</language>
    <item>
      <title>Working collaboratively with git</title>
      <dc:creator>adikejre</dc:creator>
      <pubDate>Fri, 07 Apr 2023 12:14:21 +0000</pubDate>
      <link>https://forem.com/adikejre/working-collaboratively-with-git-3h8c</link>
      <guid>https://forem.com/adikejre/working-collaboratively-with-git-3h8c</guid>
      <description>&lt;p&gt;Git is very useful when working with other developers. It helps keep track of changes, allows you to undo mistakes, integrate changes from other developers and work together as a team.&lt;br&gt;
For example:&lt;br&gt;
You and your friend are working on a project collaboratively and making changes, writing, rewriting and editing&lt;br&gt;
As you both are working on different parts of a file and constantly editing, it would be preferable to track the changes instead of manually keeping all the versions of the file in your system (like project_part1, project_final, project_final2… it gets really messy and it gets easy to lose track) &lt;br&gt;
Add another person and their changes to the equation it gets worse to manage. In this post you will see a workflow on how 2 developers can use git to work collaboratively. &lt;br&gt;
For a basic introduction to git, checkout my previous &lt;a href="https://dev.to/adikejre/git-demystified-4pda"&gt;post.&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Initial Setup
&lt;/h2&gt;

&lt;p&gt;We can start with creating an empty repository in Github and cloning it to our machine as below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--maCneiC5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x537jafqrmrvm21ywjr4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--maCneiC5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x537jafqrmrvm21ywjr4.png" alt="c3" width="757" height="348"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the base directory we create an HTML file with some content to get started with and commit and push the changes to Github.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7IquBCLG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d0be62qtwou7m83m7u9g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7IquBCLG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d0be62qtwou7m83m7u9g.png" alt="c5" width="726" height="610"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can now create a branch to work on for our changes as shown following so that we dont push unecessary changes to the the main branch.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VOVBvLBw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m9qvbafqg8kut1fmw9ao.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VOVBvLBw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m9qvbafqg8kut1fmw9ao.PNG" alt="c24" width="880" height="377"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We use the commands &lt;code&gt;git branch &amp;lt;branch_name&amp;gt;&lt;/code&gt; and &lt;code&gt;git checkout &amp;lt;branch_name&amp;gt;&lt;/code&gt;as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wXHgSH4D--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zi7n6ku8psl7ny1r7y2l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wXHgSH4D--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zi7n6ku8psl7ny1r7y2l.png" alt="c8" width="771" height="205"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can see the &lt;code&gt;test1&lt;/code&gt; branch in github with our changes and an option for raising a pull request which we will see shortly&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EqATT3Bi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xmnu2ecz3z4gmsh608nz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EqATT3Bi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xmnu2ecz3z4gmsh608nz.png" alt="c10" width="880" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt; Developer 2 adding changes &lt;/h3&gt;

&lt;p&gt;Now as your friend wants to contribute to the project, they can clone the project to their system, create a new branch &lt;code&gt;test2&lt;/code&gt; from &lt;code&gt;main&lt;/code&gt; and start working on their changes&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6dBqsGFu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9bf48s1hiov2ps7h0doh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6dBqsGFu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9bf48s1hiov2ps7h0doh.png" alt="c11" width="636" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;They add the following changes to the &lt;code&gt;&amp;lt;style&amp;gt;&lt;/code&gt; in the html file and commit and push the changes to the &lt;code&gt;test2&lt;/code&gt; branch.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tkumbgdy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/umvo6mjdoiwoi89tea1q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tkumbgdy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/umvo6mjdoiwoi89tea1q.png" alt="c12" width="880" height="541"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating Pull Request
&lt;/h2&gt;

&lt;p&gt;The changes made by the two developers now exists in their respective branches. They want to add their changes to the &lt;code&gt;main&lt;/code&gt; branch so that both of their changes are 'merged' .&lt;br&gt;
To do that a pull request is created which is a merge request to add your changes to the main branch.&lt;/p&gt;

&lt;h4&gt; Pull Request from test1 branch &lt;/h4&gt;

&lt;p&gt;For the first pull request, we want to merge changes from &lt;code&gt;test1&lt;/code&gt; branch to the &lt;code&gt;main&lt;/code&gt; branch. We compare the changes as following a create a pull request for the content changes:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--n_5N6zCl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5kuyy8r60wqogcvxfh2b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--n_5N6zCl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5kuyy8r60wqogcvxfh2b.png" alt="c17" width="880" height="485"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On creating the pull request, we can see there are no merge conflicts and the branch can be merged into main.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ycUiNjg_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ch0h2use951heonifi8u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ycUiNjg_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ch0h2use951heonifi8u.png" alt="c18" width="880" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And now in the main branch we see the changes getting reflected!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--I9bhDvWB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ljmzrnwjnjnh7wgivj2q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--I9bhDvWB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ljmzrnwjnjnh7wgivj2q.png" alt="c19" width="880" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt; Pull Request from test2 branch &lt;/h4&gt;

&lt;p&gt;Similarly we create a pull request from &lt;code&gt;test2&lt;/code&gt; to &lt;code&gt;main&lt;/code&gt; for the styling changes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9glnr3O2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xlkv01gd87a9begkpqgs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9glnr3O2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xlkv01gd87a9begkpqgs.png" alt="c20" width="880" height="669"&gt;&lt;/a&gt;&lt;br&gt;
The branch can be merged as there are no conflicts and we merge pull request.&lt;/p&gt;

&lt;p&gt;And now we see in our &lt;code&gt;main&lt;/code&gt; branch, the changes from both the branches is reflected!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--m0caVWC3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nd612lvwa0ku78s7tysl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--m0caVWC3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nd612lvwa0ku78s7tysl.png" alt="c21" width="880" height="517"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now if we want to continue working on our &lt;code&gt;test1&lt;/code&gt; branch and pull the latest changes from main, we can do it painlessly with the &lt;code&gt;git pull&lt;/code&gt; command as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8kNwfZPU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kfjpisv5klmc54awc1m2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8kNwfZPU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kfjpisv5klmc54awc1m2.png" alt="c22" width="880" height="467"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fEeEkG78--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rbqsdkos0g9i76exgug6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fEeEkG78--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rbqsdkos0g9i76exgug6.png" alt="c23" width="880" height="468"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;br&gt;
This is how we can work collaboratively with git. It scales really well when working on projects in large teams and is a really powerful tool for ensuring mistakes are minimized and all changes are appropriately reviewed before merging. Thus, following this simple workflow can make it very easy to work collaboratively and definitely will make you want to consider using this in your next project!&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>tutorial</category>
      <category>git</category>
      <category>github</category>
    </item>
    <item>
      <title>Git Demystified</title>
      <dc:creator>adikejre</dc:creator>
      <pubDate>Wed, 05 Apr 2023 17:23:51 +0000</pubDate>
      <link>https://forem.com/adikejre/git-demystified-4pda</link>
      <guid>https://forem.com/adikejre/git-demystified-4pda</guid>
      <description>&lt;p&gt;Git can seem to be an intimidating tool to use and especially for those starting out, it is easy to get lost in the complexities and the vast use cases which might lead you to wonder- Is it worth the headache? &lt;br&gt;
In this blog, I will attempt to show a simple workflow on how to use git in a simplified way and cover basic commands and use cases. This will help in getting comfortable with using git and github and cover basic commands to get started with.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Git?
&lt;/h2&gt;

&lt;p&gt;Git is a version control system which lets you to track all the changes made to a file system.&lt;br&gt;
A repository is created and initialized which contains all the files. Git maintains a history of all changes made to these files over time. This allows you to view the changes made to the code, collaborate with other developers, revert to previous versions and essentially time travel between the different versions of the code base.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a Github Repository
&lt;/h2&gt;

&lt;p&gt;We can easily create a repository as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZeDcxIC5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tqgqoao5zaoa1k5afkhp.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZeDcxIC5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tqgqoao5zaoa1k5afkhp.PNG" alt="create repo" width="880" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once it is created, we can clone the repository on our local machine so that we can easily make changes in our files. For this we use the command: &lt;code&gt;git clone&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NxPjo24I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4ffjbde9elxmznp0hrrq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NxPjo24I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4ffjbde9elxmznp0hrrq.png" alt="cloning" width="880" height="390"&gt;&lt;/a&gt;&lt;br&gt;
We copy the https key and do git clone as shown below using powershell&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YbaJPn8r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/szneaf1tr91q24xlkihz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YbaJPn8r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/szneaf1tr91q24xlkihz.png" alt="powershell" width="757" height="348"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Great! so now we have created an empty repository and cloned that on our local system. You can see the &lt;code&gt;.git&lt;/code&gt; folder present in the project's root directory.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BKR605Oy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3gpgu0j44skty3pk2stj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BKR605Oy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3gpgu0j44skty3pk2stj.png" alt=".git folder" width="757" height="227"&gt;&lt;/a&gt;&lt;br&gt;
Now we can start adding files and making changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Making changes and pushing the code
&lt;/h2&gt;

&lt;p&gt;Now in the directory where we have cloned, we can create a sample html file and add content.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BjGYa-pm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/edblcq419alpre9rjgv3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BjGYa-pm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/edblcq419alpre9rjgv3.png" alt="html file" width="726" height="610"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we need to accomplish the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add all our changes to the working tree so that we can push it&lt;/li&gt;
&lt;li&gt;Commit our changes to record all the changes we have made&lt;/li&gt;
&lt;li&gt;Push our changes to github&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For this we use the following commands:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;git add -A&lt;/code&gt; : This adds all our changes made in our directory &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;git commit -m "commit message"&lt;/code&gt; : This records the changes and adds a comment to the commit.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;git status&lt;/code&gt; : To see all the changes which are staged but not yet pushed&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;git push&lt;/code&gt; : This uploads the changes to the remote repository which is in github&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These commands are seen below in action:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kl5peHaE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/48e0m4vd71r5rkwecha4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kl5peHaE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/48e0m4vd71r5rkwecha4.png" alt="commands" width="880" height="465"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And here instantly we can see the file we created and all the changes reflected on our github repository.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gCztSa0M--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uvxvvy1gfl575nhnwc0p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gCztSa0M--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uvxvvy1gfl575nhnwc0p.png" alt="Github" width="880" height="382"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Git Branches
&lt;/h2&gt;

&lt;p&gt;Creating separate branches to work on is very useful especially when working on different features which you want to keep separated. It is good practice to work on a branch instead of the main so that the main or master branch is protected and changes are only made to the required branch.&lt;/p&gt;

&lt;p&gt;The following commands are used:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;git branch &amp;lt;branch_name&amp;gt;&lt;/code&gt; : Creates a new branch with given name&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;git branch&lt;/code&gt; : Gives the name of the current branch&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;git checkout &amp;lt;branch_name&amp;gt;&lt;/code&gt; : Shifts to the given branch&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2ut0LlBe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/spqxcwi2ndjgavzd1ai3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2ut0LlBe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/spqxcwi2ndjgavzd1ai3.png" alt="branch" width="771" height="205"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thus it is easy to switch between branches and using different branches for different features is often useful.&lt;/p&gt;

&lt;p&gt;We create a branch &lt;code&gt;test1&lt;/code&gt; and push the changes to it. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--u3VNekZl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ugfafc0g9be7j4qh1dvh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--u3VNekZl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ugfafc0g9be7j4qh1dvh.png" alt="test1 branch" width="577" height="567"&gt;&lt;/a&gt;&lt;br&gt;
Note that when pushing to a new branch which does not have an upstream branch in github yet, we use &lt;code&gt;git push --set-upstream origin test1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now a friend wants to contribute to your project. This is easy to do as they can clone the repository in their system and create a branch and start working on their own.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GnTwgXbw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q6k3xpwv7wh9au1hrdsz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GnTwgXbw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q6k3xpwv7wh9au1hrdsz.png" alt="branching" width="636" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As shown above, the repository is cloned and &lt;code&gt;test2&lt;/code&gt; branch is created to work on.&lt;/p&gt;

&lt;p&gt;This covers the basics of setting up a git project, and a workflow on the basics of git you need as a developer working on your personal project and wants to start with simple version control to make life easier. In the next posts, I will go into more detail on how to work collaboratively using git, make pull requests and cover other useful commands.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>git</category>
      <category>github</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
