Loading...

This site has a collection of links for git. For me as Mercurial user, the concept is a little bit different. This collection helps me to bridge the indifference.

Getting Started

git concepts

Working with git

Settings

Identity

Setup identity (replace it with real data, unless you are Jason Bourne :smile:)

$ git config --global user.name "Jason Bourne"
$ git config --global user.email jason.bourne@example.com

Proxy

Setup network proxy, if you working behind a proxy. This example assumes you are using cntlm

git config --global http.proxy http://localhost:3128
git config --global https.proxy https://localhost:3128

Credential Manager

With windows a pain in the ass.

As user

git config --global --unset credential.helper

Use this if you have admin privileges

git config --system --unset credential.helper

Undoing things

Revert last commit

git reset --soft HEAD~

Removing a Tag

$ git tag -d v5.3.1
$ git push origin :refs/tags/v5.3.1

Show History

git log displaying graph for separate branches

git log --oneline --decorate --graph --all
#..
| *   cde6400 merged from mike
| |\
| * | 37dec4e added unit tests for CLExtension
| * |   51b4502 merged mike's changes
| |\ \
| * | | 9faf729 removed shell.write(), commands are now limited to one name, began testing CLExtension
* | | | 0e915fa Add ShellUtils.java
| |_|/
|/| |
* | | 535d0f7 prompting for mandatory parameters now supported
| |/
|/|
* | 93742a2 add coercion support with MVEL

Remove a file from git

If you have a file that was wrongly added:

tan@omega:~/sources/strechy-elastic-rest-client/src/main/resources$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   test.yml

Forget with

tan@omega:~/sources/strechy-elastic-rest-client/src/main/resources$ git rm --cached test.yml
error: the following file has staged content different from both the
file and the HEAD:
    src/main/resources/test.yml
(use -f to force removal)
tan@omega:~/sources/strechy-elastic-rest-client/src/main/resources$ git rm --cached test.yml -f
rm 'src/main/resources/test.yml'