Results: 1578
Notes
  • Newest first
  • Oldest first
  • Newest first(All)
  • Oldest first(All)
Deletes the last 3 commits
git reset --hard HEAD~3
Deletes all commits after the specified commit and moves HEAD to that commit (this will get rid of changes so we should be careful)
git reset --hard 004caa3
by Valeri Tandilashvili
5 years ago
0
Git
Git/Github Tutorial
0
shows the difference between the working directory and index
git difftool HEAD
Shows the difference between the commits in some of the difftool apps (that is previously configured)
git difftool a8098222d481b2c4249e09cdf639427b237a1d8f 17d3352bd6486e4c34bbfc51053c7b86911458da
Shows the difference between
login.frm
files from different commits in default diff.tool
git difftool a8098222d481b2c4249e09cdf639427b237a1d8f 17d3352bd6486e4c34bbfc51053c7b86911458da login.frm
If the diff.tool is not configured, the default console diff tool
vimdiff
will be used instead. ... Shows what default diff.tool is
git config --global merge.tool
Shows what meld.path is
git config --global mergetool.meld.path
Configure merge tool and set
meld
as default
git config --global merge.tool "meld"
git config --global mergetool.meld.path "C:\Program Files (x86)\Meld\Meld.exe"
Configure difftool prompt to false
git config --global difftool.prompt false
by Valeri Tandilashvili
5 years ago
0
Git
Git/Github Tutorial
1
Lists all commits of the local repository
git log
Lists all commits each on one line (only commit identifier and commit message)
git log --pretty=oneline
Almost the same as the above command. But the commit identifier is shortened (only the first several symbols)
git log --oneline
If we are on
master
and we want to see other branch's commits
git log another_branch
After fetching new commits from remote, we can see the new commits (even if we are on
master
)
git log origin/master --oneline
Shows some abbreviated stats for each commit
git log --stat
It shows all commits in the history of branches, tags and other refs, but it does not show commits that are not reachable from any ref
git log --all
We can even specify a format of the commits history
git log --pretty=format:"%h - %an, %ar : %s"
Where:
%h
is the commit identifier
%an
- author of the commit
%ar
- how much time ego was created
%s
- message of the commit The format result:
a11bef0 - Scott Chacon, 6 years ago : Initial commit
... Funny format which will result in:
54d459d by VLR, which created the commit 28 hours ago with comment: some messagee
git log --pretty=format:"%h by %an, which created the commit %ar with comment: %s"
by Valeri Tandilashvili
5 years ago
0
Git
1
git show
Shows changes of the commit
git show a8098222d481b2c4249e09cdf639427b237a1d8f
Shows only
index.html
changes from the commit
git show a8098222d481b2c4249e09cdf639427b237a1d8f index.html
Shows changes of the last commit (HEAD always points to the last commit if it is not detached)
git show HEAD
by Valeri Tandilashvili
5 years ago
0
Git
1
-u
flag adds a tracking reference to the upstream server that we are pushing to. This lets us do a
git push
without specifying other arguments. For example, once we do a
git push -u origin master
, we can later run
git push
and git will know that we meant
git push origin master
by Valeri Tandilashvili
5 years ago
0
Git
1
Merge
login
branch into
master
git merge login
Note:
we must be on master branch if we want some other branch to merge on it
by Valeri Tandilashvili
5 years ago
0
Git
Git & GitHub Crash Course For Beginners
1
Lists all local branches. Current branch is highlighted (with green color)
git branch
Lists all remote branches
git branch -r
Lists all local and remote branches
git branch -a
Creates new branch
login
to work on login functionality on the branch
git branch login
Shows branches that are merged already
git branch --merged
Deletes the
login
branch
git branch -d login
Deletes the
login
branch (with force mode, which means - the branch will be deleted, even if it's not fully merged
git branch -D login
by Valeri Tandilashvili
5 years ago
0
Git
Git & GitHub Crash Course For Beginners
1
Files or folders that we don't want to include, should be inside
.gitignore
file. For example, if we don't want to include any .txt files, any files inside /docs directory, and also any .html files inside /dir, then the file will contain:
*.txt
/docs
/dir/*.html
by Valeri Tandilashvili
5 years ago
0
Git
Git & GitHub Crash Course For Beginners
1
git restore --staged
Removes
index.html
file from staging area
git restore --staged index.html
Removes all files from staging area
git restore --staged .
Alternative command is:
git reset HEAD index.html  /  git reset HEAD .
by Valeri Tandilashvili
5 years ago
0
Git
1
Clears previous console info
also works on windows PowerShell
by Valeri Tandilashvili
5 years ago
0
Git
Git & GitHub Crash Course For Beginners
1
Results: 1578