GIT cheat sheet will save your time in learning all commands.
It will help you to know about the right commands you must know.
Getting Started With GIT Cheatsheet
Configuration:
- git config –global push.default current
- git config –global color.ui true
- git config –global user.email foo@citrix.com
- git config –global user.name “John Doe”
- git config –global diff.tool meld
- git config –global core.editor vim
See List of Local Branches: Cheat Sheet Template
Git branch
Switch to the local branch that is existing:
git checkout branchname
Checkout the current branch with new branch that is named with new branch name:
git checkout -b new-branch-name
Merge the branch name to current branch:
git merge branchname
Soft branch delete, complain if branch will not be merged:
git branch -d branchname
Updating Current Branch: The Best Cheat Sheet Template
Standard Flow
See commits:
git log
Commit view and customize it:
git log –pretty=format:”%h %s” –graph
Check what you have worked in past week:
git log –author=’Alex’ –after={1.week.ago} –pretty=oneline –abbrev-commit
Check changes made on your branch:
git log –no-merges master..
Check status of current GIT branch:
git status
View status:
git status –s
Add or modified the file that will be committed:
git add filename
Add text files:
git add ‘*.txt’
Tell the GIT not track anymore:
git rm filename
Also, if you want to know more about web development, read about underscore JS cheat sheet!
Cheat sheet tips: Advanced
Unstage the pending changes where changes will remain on the file system like:
git reset
Unstage the pending changes and to reset files in pre-committing state:
git reset –hard HEAD
Go back in the history of current branch:
git reset tag
git reset <commit-hash>
Save the current changes and ensure not to commit repo:
git stash
return to changes:
git stash pop
For another cheat sheet tips, here are information about comparing changes in GIT.
Check current changes that is not being staged yet:
git diff
Check current changes that is not being committed yet:
git diff HEAD
Compare the current branch to some of the other branch:
git diff branch-name
Check changes in current branch:
git difftool -d master..
Check file names that have been changed in the current branch:
git diff –no-commit-id –name-only –no-merges origin/master…
Working With the Remote Branch
Check the list of the remote repost that are available:
git remote
View details of the remote repos having GIT URLs:
git remote –v
Add new remote:
git remote add origin
How to do a cheat: GIT Terminology
Master: default the branch that develop in
Origin: default the upstream repo
HEAD: current branch
Remote: Repository stored in another computer
Staging or adding: Adding changed files in the index tree that will be committed
git cheat sheet on how to start repo init/remote/ clone
git init: Make repo from the existing data
git clone (repo_url): Clone the current repo
git clone (repo_url) (folder_name): Clone repo in specific folder name
git cline (repo_url): Clone repo in current directory
The ways on how to do a cheat is easy with cheat sheet software as long as you gathered all the information you need. What you need to do is to write it in one page paper.
Use our good GIT cheat sheet today!
Reference:
https://gist.github.com/akras14/3d242d80af8388ebca60