Simple guide to git

Simple and easy guide for git beginners.

Getting Started – Installing Git

Installing on Linux –
Installing on Mac –
Installing on Windows –

Create a new repository

Create a new folder, and open it,
Right click in the folder, choose “Git Bash Here”

$ git init

You may notice that there is now a hidden folder called .git in the folder.

Clone a checkout repository

$ git clone

when using a remote server, your command will be

$ git clone username@host:/path/to/repository

Adding & Commiting

$ git add <filename>

$ git add *

for commit these changes use

$ git commit -m “Here is Commit Message”

Now the file is committed, but not in your remote repository.

Push changes to remote

Your changes are now in local working copy. To send those changes to your remote repository use:

$ git push origin master

‘master’ is the branch you want to push your changes.

Git Branching
A branch in Git is simply a lightweight movable pointer to one of these commits. The default branch name in Git is master. As you start making commits, you’re given a master branch that points to the last commit you made. Every time you commit, it moves forward automatically.

create a new branch named “branch_name”.

$ git checkout -b branch_name

switch back to master

$ git checkout master

and delete the branch again

$ git branch -d branch_name

push the branch to remote repository

$ git push origin <branch>

Update & Merge

Update your local repository

$ git pull

to merge another branch into your active branch

$ git merge <branch>

For More On Git Documentation

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s