×
Clear all filters including search bar
Valeri Tandilashvili's Personal Professional Blog
new_branch
on remote repositorygit push origin --delete new_branch
git push origin new_branch
If the branch does not exist on remote repository, first should be run this command:git push --set-upstream origin new_branch
Alternative of the above command is this command:git push -u origin new_branch
To delete branch new_branch
on remote repositorygit push origin new_branch --delete
login
branchgit branch -d login
Deletes the login
branch (with force mode, which means - the branch will be deleted, even if it's not fully mergedgit branch -D login
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.toolgit 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 isgit config --global merge.tool
Shows what meld.path isgit config --global mergetool.meld.path
Configure merge tool and set meld
as defaultgit config --global merge.tool "meld"
git config --global mergetool.meld.path "C:\Program Files (x86)\Meld\Meld.exe"
Configure difftool prompt to falsegit config --global difftool.prompt false
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 commitsgit 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 commitgit 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 refgit log --all
We can even specify a format of the commits historygit 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"
git show a8098222d481b2c4249e09cdf639427b237a1d8f
Shows only index.html
changes from the commitgit 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
-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
login
branch into master
git merge login
Note: we must be on master branch if we want some other branch to merge on it
git branch
Lists all remote branchesgit branch -r
Lists all local and remote branchesgit branch -a
Creates new branch login
to work on login functionality on the branchgit branch login
Shows branches that are merged alreadygit branch --merged
Deletes the login
branchgit branch -d login
Deletes the login
branch (with force mode, which means - the branch will be deleted, even if it's not fully mergedgit branch -D login
.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