Configure Tooling
Sets the name you want attached to your commit transactions
git config --global user.name "[name]"
Sets the email you want attached to your commit transactions
git config --global user.email "[email address]"
Create Repositories
Creates a new local repository with the specified name
git init [project-name]
Downloads a project and its entire version history
git clone [url]
Make Changes
Lists all new or modified files to be committed
git status
Shows file differences not yet staged
git diff
Snapshots the file in preparation for versioning
git add [file]
Records file snapshots permanently in version history
git commit -m "[descriptive message]"
Group Changes
Lists all local branches in the current repository
git branch
Creates a new branch
git branch [branch-name]
Switches to the specified branch and updates the working directory
git checkout [branch-name]
Combines the specified branchβs history into the current branch
git merge [branch]
Deletes the specified branch
git branch -d [branch-name]
Refactor Filenames
Deletes the file from the working directory and stages the deletion
git rm [file]
Changes the file name and prepares it for commit
git mv [file-original] [file-renamed]
Suppress Tracking
Lists the files and directories that git should ignore
.gitignore
Review History
Displays commit history
git log
Shows content differences between two branches
git diff [first-branch]...[second-branch]
Save Fragments
Temporarily stores all modified tracked files
git stash
Restores the most recently stashed files
git stash pop
Lists all stashed changesets
git stash list
Discards the most recently stashed changeset
git stash drop
Synchronize Changes
Downloads all history from the repository bookmark
git fetch [bookmark]
Combines bookmarkβs branch into current local branch
git merge [bookmark]/[branch]
Uploads all local branch commits to gitHub
git push [alias] [branch]
Downloads bookmark history and incorporates changes
git pull
Top comments (0)