Git Cheat Sheet

A set of selected git commands which are used almost on a daily basis. The commands are taken from the github official documentation.

Note: [] = only the content without [] ; “[]” = content inside “”

Configuration:


 

> git config –global user.name “[name]”
> git config –global user.email “[email address]”

Local Repository Creation:


> git init [project-name]
> git clone [url]

Before & During the push:


> git add [file]
> git commit -m “message”

Grouping:


> git branch
> git branch [branch-name]
> git checkout [branch-name]
> git merge [branch]
> git branch -d [branch-name]  // deleting a branch

Review History:


> git log

Redo Commits:


> git reset [commit]   // commit no. from the git log
> git reset –hard [commit]

Save Fragments:


> git stash
> git stash drop

Synchronization:


> git push [alias] [branch]  // pushes the changes from local to the remote repository
> git pull  // updates the local repository
> git merge [bookmark]/[branch]

Suppress Tracking:


.gitignore file holds the following command to avoid temporary files, and paths:

*.log
build/
temp-*
lists of all ignored files: git ls-files –other –ignored –exclude-standard
 my git profile: my git

reference: github cheat sheet

Author: ashiquechowdhury

A software developer, and a data science enthusiast

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s