Cheatography
https://cheatography.com
This cheat sheet contains commands for using git
git commands for version tagging
|
List all available tags in Git |
|
search for tags with the particular tag_number |
git tag -a [tag_number] -m [message]
|
creates an annotated tag with an optional tagging message |
|
shows the tagger information |
git tag [tag_number]-lw
|
creates a lightweight tag |
git tag -a [tag_number] [part_of_check_sum]
|
tags the commit after you've moved passed them |
git push origin [tag_number]
|
push version_number to shared server after you have created them. |
|
push tags to shared server |
git checkout -b [branch_name] [tag_name]
|
put a version of the repository in your working directory that looks like a specific tag |
By default, the git push command doesn't transfer tags to remote servers. You will have to explicitly push tags to a shared server after you have created them. This process is just like sharing remote branches, you can run git push origin "tag_name"
|
git commands to clone and create repositories
|
Initializes a new git repository in the current directory |
|
Clone an existing Git repository located at in the current directory |
git clone url directory_name
|
Clone an existing Git repository located at in directory_name |
git commands to check status
|
used to determine which files are in which state |
|
the short and compact representation of git status |
git commands for removing and renaming files
|
Removes the file from your tracked files and the working directory |
git rm --cached "file_name"
|
Removes the files from your tracked files but keeps the file in the working directory |
git mv "file_from" "file_to"
|
Renames the file form "file_from" to "file_to" |
git commands for undoing things
|
used to unstage the "file_name |
git checkout -- [file_name]
|
reverts a file to the previous version |
git commands for staging files
|
Stage file_name for commit |
|
Stage all modified or new files for commit |
|
Unstage file_name |
git commands for working with remotes
git remote add "name" "url"
|
Create a new remote named "name" for the repository at "url" |
|
Download all changes from "remote", but don't integrate into current branch |
git merge "remote"/"branch"
|
Merge "remote]/[branch" into current branch |
git push "remote" "branch"
|
Push local changes in "branch" to "remote"/"branch" |
git pull "remote" "branch"
|
Fetch and merge all changes from "remote"/"branch" into current branch |
|
|
git commands for commiting changes
git commit -m "message"
|
Commit staged changes with "message" describing changes |
|
Edit the previous commit message or contents |
git commit -a -m "message"
|
Stages all already tracked files and commits them |
git commands for branching and merging
git remote add "name" "url"
|
Create a new remote named "name" for the repository at "url" |
|
Create a new branch named "name" |
|
Switch to branch named "name" |
|
Merge "branch" into current branch |
git merge --no-ff "branch"
|
Merge "branch" into current branch, keeping branch history |
git commands for inspections and differences
|
View the commit history of the current branch |
|
View the commit history of "branch" |
|
Prints below each commit entry a list of modified files, how many files where changed, and how many lines in those files where added or removed |
git log --pretty=online
|
This option changes the log output to formats other than the default |
|
Display an ASCII graph of the branch and merge history beside the log output |
|
View unstaged changes between the current state of the code and the last commit |
|
View staged changes between last commit and the current state of the code |
git diff "branch1" "branch2"
|
View differences between "branch1" and "branch2" |
|
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets