Git Tutorials

May 23, 2017

Image

Here are few git commands for accessing git based projects properly.

 

1. Create Clone (local version) of a git repository (a.k.a. repo):

> git clone {github repo url}

2. Create branch from current branch:

> git checkout -b {new branch name}

* Always keep current branch (a.k.a. base branch) note. 

3. Download branch code locally.(Pull)

> git pull origin {branch name}

4. Upload your code remotely (on github.com repository)

> git push origin {branch name}

5. Add new files in your current branch.

> git add .

or

> git add {File name with path}

6. Commit your changes to remote branch.

> git commit -m {commit message}

7. Switch branches locally

> git checkout {to branch name}

8. Remove branch locally.

> git branch -d {branch name}

9. Remove branch remotely

> git branch -d origin/{branch name}

10. Show last commits

> git log

 

These are few basic commands. I will add advance commands in next week till then bye..

 

Thanks,

Ajinkya