Git Manual for Beginners

May 19 · 3 min read

Git is the most popular distributed version control system for tracking change. if you are a newcomer to the software development world, you have to know it, you have to use it. my advice to you if you are a newbie to software development world to try to use Git with GUI tool like source tree, it is much easier for you in your first steps, then you can go and dig in deep with git commands. but the black fact that Git is meanly a command line.

Simple & Basic terms you have to know

Clone:

Create a local copy from a remote repository.

Commit:

Save the changes you want to the local repository, with a commit message.

Checkout:

Get a branch from the origin. switching between branches.

Pull:

Update your local branch with latest updates from remote. You are literally “pulling” server changes onto the local repository.

Push:

Updates a remote branch with your local commits. You are literally “pushing” your changes onto the remote.

Tag:

Mark a commit with important information or flag.

Rebase:

Integrate changes from one branch into another, you can split the commit, move it, squash commits if unwanted, or effectively combine two branches that have diverged from one another.

ADD:

Add all modified and new (untracked) files.

Git cheat sheet

Git cheat sheet

Git Flows:

In this article, we will not go deep in git flow, all you need as a beginner to understand is your team git-flow if you don’t work on a team. you can follow the simple feature branches git-flow. Simply it is a feature per branch, so whenever you work in a new feature you have to create a sperate branch from develop branch, and when you complete feature you have to merge it to develop.

Don’t mix features in one branch.

Write meaningful names for your branches, and if your git system integrated with something like Jira, you can add your ticket ID so it will appear in Jira.

Basic Git Commit:

Commit messages is very important to be clear and descriptive.write readable messages, try to describe what you did.

I found in some repositories horrible commit messages which can’t describe anything, just rubbish.

Bad examples:

  • “Chris coffee” it was one of the worst commit messages I have ever read! don’t believe me! see more.
  • “comit” yes it was a commit message in one of the repositories !!
  • “asd” yes it was a commit message in one of the repositories !!

you can imagine after those bad examples, How is the code in this repository! so don’t write rubbish commit messages under any circumstances.

so we can say your commit messages is a title for your code in this commits & repository.

Simple hints for good commit messages:

start your commit with a verb, as it provides useful context about the rest of its title, such as:

  • ‘implement’ — for the new feature adding to a particular level of an application;
  • fix’ — for a serious bug fixing;
  • ‘add’ — for adding untracked files, Add new UI resources.
  • ‘refactor’ — for refactoring the code of an application;

it will make your commit messages easier to read between team members if you define a git commit messages protocol.

Resources:

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade