DEV Community

Cover image for GIT FOR A BEGINNER
JaswanthReddyPadala
JaswanthReddyPadala

Posted on

GIT FOR A BEGINNER

GIT?

Git was created by Linus Torvalds in 2005 for the development of the Linux kernel, with other kernel developer team. Git is a distributed version control tool. In simple language, Git is like a record book, it keeps on tracking your files and changes made in project files.

WHY GIT?

Although there are dozens of version control systems on the market like CVS, SVN, Mercurial, Bazaar, etc. But let's know what makes git more popular and powerful?

  • Save time
    Git is a cool and very fast tool. Simple commands save us a lot of time. We can easily push codes and it improves team collaboration.

  • Offline
    Git can also be used in offline mode expect when you try to push your code to an online repository or cloud. But if you're using CVS you need to be connected to the central repository. This is not the case with git, you can happily do everything in your local machine itself like add, make commits, merge or create branches, push your codes, and many actions as you explore.

  • Undo or Redo mistakes
    Generally, people make mistakes. It is one of the features in git is like a undo command. If you have messed up your code at some point in time then you can "undo" and go back in time in sense of code where you have a working code in the commit history. You can even restore disappeared commits. Awesome right?.

  • Clone a project
    If you ever see a good project in someone's repository and if you want to work on it and make your own version of that project. Git gives the functionality of cloning the project without deleting anything from the original repository. It copies whole files in someone's repository to your local machine and any changes you made in those files don't affect the original repository.

  • Commits
    A commit is really useful if it contains related changes. When you change or add some feature you give a commit message and explaining about the change you committed in a meaningful way. For example, the person is adding a new feature 'A' he can commit something like "added feature A". In case the feature 'A' is not working properly we can revert back to the code before adding this new feature.

  • Don't touch working code
    While you’re working on the feature 'A', What will be the situation if the new feature 'A' is not needed after making several commits to the main code. While developing a working code, nothing else should be affected by your unfinished code. To deal with this kind of situation Branching is the only option. Using this feature, we can create a new branch to the main code without disturbing the main code. And later if the new code perfectly fits and works with then we can merge this branch with the main branch to develop a fully working code with the new feature 'A'.

So why late, start learning how to this awesome tool and use git

Resources: Git book | Git cheat sheet

Leave you thoughts in the comment section

Thank you for reading 🙏
Jaswanth Reddy Padala - Email | Linkedin | Twitter

Top comments (0)