Git Cheatsheet Page 2

ADVERTISEMENT

GIT CHEATSHEET
5. REVIEW YOUR WORK
6. TAGGING KNOWN COMMITS
C. THE ZOO OF WORKING AREAS
Another remote repository.
$ git log [-n count]
$ git tag
Git is a distributed version conrol
Remote repository
system. You can have as many
List commit history of current branch. -n count limits list to last n commits.
List all tags.
named origin?
remote repositories as you want.
You've probably made
Just remeber to update them
git clone from here.
$ git log --oneline --graph --decorate
$ git tag [name] [commit sha]
frequently :)
An overview with references labels and history graph. One commit per line.
Create a tag reference named name for current commit. Add commit sha to
remote repo
remote repo
tag a specific commit instead of current one.
(name: origin)
(name: public)
$ git log ref..
$ git tag -a [name] [commit sha]
List commits that are present on current branch and not merged into ref.
git fetch
git push
git push public master
Create a tag object named name for current commit.
A ref can be e.g. a branch name or a tag name.
or
git pull
remote repositories
$ git log ..ref
$ git tag -d [name]
local repository
List commit, that are present on ref and not merged into current branch.
Remove a tag from a local repository.
repository
git commit
$ git reflog
Changes commited here
7. REVERTING CHANGES
will be safe.
List operations (like checkouts, commits etc.) made on local repository.
index
If you are doing backups!
You are doing it, right!?
(staging area)
8. SYNCHRONIZING REPOSITORIES
$ git reset [--hard] [target reference]
git reset HEAD
Switch current branch to the target reference, and leaves a difference as an
stash
git stash
Only index will be
uncommited changes. When --hard is used, all changes are discarded.
committed.
$ git fetch [remote]
git add
Choose wisely
working
A kind of a shelf
git stash pop
what to add!
$ git revert [commit sha]
Fetch changes from the remote, but not update tracking branches.
for the mess
directory
you don't want to include.
Create a new commit, reverting changes from the specified commit. It
$ git fetch --prune [remote]
generates an inversion of changes.
You do all the
Remove remote refs, that were removed from the remote repository.
hacking right here!
$ git pull [remote]
D. COMMITS, BRANCHES AND TAGS
Fetch changes from the remote and merge current branch with its upstream.
commit
an object
branch
a reference to a commit; can have a tracked upstream
$ git push [--tags] [remote]
tag
a reference (standard) or an object (annotated)
Push local changes to the remote. Use --tags to push tags.
This is a local branch.
It is 3 commits ahead,
HEAD
a place where your working directory is now
you see it, right?
$ git push -u [remote] [branch]
This is an upstream branch
This is also
a local branch
Push local branch to remote repository. Set its copy as an upstream.
This is a tag. It looks like a developer's
note so it's probably a reference,
not an object.
A n d t h i s i s t h e p a s t . H e r e w a s c h a o s ,
This is a merge commit,
This is an initial commit,
This is a normal commit,
it has two parents!
w h e r e n o v e r s i o n c o n t r o l w a s u s e d .
it has no parents
it has one parent
This is a tag. It looks like a
D o n ' t l i v e i n c h a o s !
Your working directory
version so it's probably an object
U s e G i t !
is here
(annotated tag)
GitLab - Everyone can contribute
v1.0.1

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education
Go
Page of 2