Git Manual for Beginners

Image for post
Image for post

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

Create a local copy from a remote repository.

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

Get a branch from the origin. switching between branches.

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

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

Mark a commit with important information or flag.

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 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.

Image for post
Image for post

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.

  • “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 !!
Image for post
Image for post

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.

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:

The Startup

Medium's largest active publication, followed by +717K people. Follow to join our community.

Ahmed Mahmoud Eltaher

Written by

Android Lead | Senior Mobile Engineer https://github.com/ahmedeltaher https://www.linkedin.com/in/ahmed-eltaher-65985252

The Startup

Medium's largest active publication, followed by +717K people. Follow to join our community.

Ahmed Mahmoud Eltaher

Written by

Android Lead | Senior Mobile Engineer https://github.com/ahmedeltaher https://www.linkedin.com/in/ahmed-eltaher-65985252

The Startup

Medium's largest active publication, followed by +717K people. Follow to join our community.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store