Predictive Hacks

Git and GitHub Cheat-Sheet

The next table shows the most common commands that you need to know for Git and GitHub.

CommandExplanation & Link
git commit -aStages files automatically
git log -pProduces patch text
git showShows various objects
git diffIs similar to the Linux `diff` command, and can show the differences in various commits
git diff –stagedAn alias to –cached, this will show all staged files compared to the named commit
git add -pAllows a user to interactively review patches to add to the current commit
git mvSimilar to the Linux `mv` command, this moves a file
git rmSimilar to the Linux `rm` command, this deletes, or removes a file
git branchUsed to manage branches
git branch <name>Creates the branch
git branch -d <name>Deletes the branch
git branch -D <name>Forcibly deletes the branch
git checkout <branch>Switches to a branch.
git checkout -b <branch>Creates a new branch and switches to it.
git merge <branch>Merge joins branches together.
git merge –abortIf there are merge conflicts (meaning files are incompatible), –abort can be used to abort the merge action.
git log –graph –onelineThis shows a summarized view of the commit history for a repo.
git clone URLGit clone is used to clone a remote repository into a local workspace
git pushGit push is used to push commits from your local repo to a remote repo
git pullGit pull is used to fetch the newest updates from a remote repository
git remote Lists remote repos
git remote -vList remote repos verbosely
git remote show <name>Describes a single remote repo
git remote updateFetches the most up-to-date objects
git fetchDownloads specific objects
git branch -rLists remote branches; can be combined with other branch arguments to manage remote branches
Git and GitHub Cheat-Sheet 1

[1] Resources: Coursera

Share This Post

Share on facebook
Share on linkedin
Share on twitter
Share on email

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore

python package

How to Build Python Packages

In this tutorial, we will show you how to build Python Packages. Our goal is to build a Python package