Git Manual for Beginners

Git Manual for Beginnersahmed mahmoud EltaherBlockedUnblockFollowFollowingMay 19Git 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 knowClone: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 sheetGit cheat sheetGit 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:Git – ReferenceQuick reference guides: GitHub Cheat Sheet (PDF) | Visual Git Cheat Sheet (SVG | PNG)git-scm.

comResources to learn GitGit, GitHub, DVCS, oh my!.Learn all the lingo and the basics of Git.

try.

github.

io.

. More details

Leave a Reply