|
HEAD
|
Head is your current branch. You can see what HEAD points to by typing
cat .git/HEAD, |
|
Remote
|
Remotes are non-local repositories you can interact with (push/pull). The default remote is origin (you can see that using
git remote -v). |
|
Branch
|
Branches are a way of safely work on new features without messing other peoples work (one feature, one branch).
|
|
Commit
|
A commit is a change or a set of changes you wish to register and save.
|
|
Create a local repository
|
mkdir ./my_repo && cd ./my_repo && git init
|
|
Clone a repository from GitHub
|
|
|
Clone a specific branch from a repo
|
git clone -b development https://github.com/TME520/etm.git
|
|
List branches
|
git branch
|
git branch --list
|
|
Clone a specific branch
|
git clone -b <branch> <remote_repo>
|
git clone -b development git@github.com:user/myproject.git
|
|
Switch to an existing branch
|
git checkout <branch>
|
git checkout feat/robert/add-pub-holidays-2020
|
|
Switch to a new branch
|
git checkout -b <new_branch>
|
git checkout -b conf/marcel/use-EditorConfig
|
|
Push changes to a remote branch
|
git push origin <branch>
|
git push origin fix/patrick/remove-parasite-chars-from-config-file
|
|
Delete a branch
|
git branch -d <branch>
|
git branch -d feat/raja/count-api-failures
|
|
Integrate your feature branch to the main
|
git merge <branch>
|
git merge main
|
|
Cancel untracked uncommited local changes
|
git reset --hard && git pull remote <remote_branch>
|
|
Set your name
|
git config --global user.name "John Doe"
|
|
Set your email address
|
git config --global user.email johndoe@example.com
|
|
Set your default editor
|
git config --global core.editor emacs
|
|
.gitignore
|
Specifies intentionally untracked files that Git should ignore. Files already tracked by Git are not affected.
|
|
.gitattributes
|
Gives attributes (end of line type, diff type, merge type...) to certain files.
|
|
Clone a repo
|
|
|
Create a new branch
|
git checkout -b conf/yu/add-api-endpoints-to-monitoring
|
|
Check repo status and current branch
|
git status
|
|
Add changes to next commit (track files)
|
git add -A
|
|
Commit with a message
|
git commit -m "Sometimes dogs are grey"
|
|
Refresh current local branch with remote branch
|
git pull origin development
|
|
Push changes to remote
|
git push origin conf/yu/add-api-endpoints-to-monitoring
|
|
Add one file to a future commit
|
git add <file>
|
git add benchmark.c
|
|
Add all files to a future commit
|
git add -A
|
|
|
Commit with a message
|
git commit -m "<message>"
|
git commit -m "Initial commit"
|
|
Change the message of the latest commit
|
git commit --amend -m "<new_message>"
|
git commit --amend -m "Beautiful commit"
|
|
Cancel a commit
|
git log -- oneline
|
|
|
git revert <commit_id>
|
||
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.