-
Notifications
You must be signed in to change notification settings - Fork 6
Git Cheatsheet
To retrieve an entire repository from a hosted location via URL:
$ git clone [url]To show modified files in working directory, staged for your next commit:
$ git statusTo show all commits in the current branch’s history:
$ git logTo add a file as it looks now to your next commit (stage):
$ git add [file]or to add all:
$ git add .To diff of what is changed but not staged:
$ git diffTo diff of what is staged but not yet committed:
$ git diff --stagedTo commit your staged content as a new commit snapshot:
$ git commit -m “[descriptive message]”or to open nano to write you commit message just simply:
$ git commitTo list your branches. a * will appear next to the currently active branch:
$ git branchTo create a new branch:
$ git branch [branch-name]To switch to another branch and check it out into your working directory:
$ git checkout [branch-name]To fetch and merge any commits from the tracking remote branch:
$ git pull [remote-name] [branch-name]To push local branch commits to the remote repository branch:
$ git push [remote-name] [branch-name]