\”Git Made Easy: Essential Basics for Your Coding Journey!\”

version control implemented at git.

It\’s a bit overwhelming when you want to learn how to code. and somehow through ups and downs you do but now it gets tiresome when you keep editing your code and saving it and then realizing you still need a version that you edited but now you have to redo the entire code. But now imagine there was a way to go back to your code without having to write it, that can be fabulous right? I know and that is where version control comes in, which is usually implemented with git.

\"\"

version control it\’s a system that tracks the history of changes as people and teams collaborate on projects together.

Now how does this git work?

Git can be categorized in different forms in which each category works different and its haves its own advantages and disadvantages.

These categories include.

  • local git,
  • collaborative or distributed git
  • advanced git

let\’s elaborate the above further by describing one by one.

1) local git.

This is very appropriate when one is working alone on his or her projects. This is possible by initializing his or her project in the template by writing the following commands.

The commands include.

  • $ git Init my project (my project usually represents the name of the project you are working on it can be tutorial or any other name that you decide to give your project)
  • $ cd my project
  • $ git add.
  • $ git commit -m.

If one is working on a project alone the above commands are exactly what is need by now if it is an organization and two or more people need to work together to accomplish the project they need to work in different branches and combine the concept together at last. Thats how we move to our second category. which is collaborative.

2)collaborative or distributed git

The exciting part takes part here which is branching, merging. Now after the hard work of learning how to code it finally pays off, and you finally get employed in the organization you have always wanted to work in. It can Microsoft or google or your favorite organization. but the issue comes when you are given a project to work on a team. and you are only needed to work on your segment and push it to git. while the other team members will also be working on their own.

The main branch which maybe the team leader will be working on is usually refereed as main or master. this is usually the branch that other Braches are derived from. i.e. let\’s have two people working on a project one is the team leader let call him john and the other one is probably you.

  • john. $git checkout master (this is the leader initializing the main branch which as you recall we said is refered to as master or main )
  • john. $git commit -a -m (my new log)
  • john. $git push

as John is working on the main branch you will also be working on another branch to complete your part

  • you .$ git checkout -b feature1(name of the branch )
  • you. $git commit -a -m \”my features code \”
  • you. $ git push origin feature1..

After you have completed your feature and you have even added it with the commit command and pushed it to git. The leader will take a preview on the code and if it needs to be corrected, he will get back to otherwise he will push it to the main branch and merge them both to create the final project. .

Here are the commands.

  • John. $git pull
  • john. $git merge feature1

3)advanced git

This is the final category. of git and which is the most advanced. it\’s usually flexible and very powerful. It usually includes adding little branches into the document, committing those selected branches and a graphical representation of showing when the team branched the files,and when they were merged and who specifically did what and when .This category is usually used by managers when in need of reviewing the work done.

the commands usually include;

  • $ git add-p my report .markdown
  • $ git commit -m \”add latest statics \”
  • $ git log – – graph – – decorate – – abbrev.
  • $ commit — all — pretty – – one line

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top