Git: links, cheatsheets, tutorials, etc…

merge and rebase

Atlassian Merge vs Rebase tutorial.

merge
### Squash merge
$ git checkout develop
$ git merge --squash feature/branch
Revert
### Revert to a specific commit
$ git checkout -f COMMITID -- .
$ git commit -a

### Revert a specific commit
$ git revert --no-commit COMMITID
git flow

Nice git flow cheatsheet.

git stash

Good tutorial from Atlassian.

git submodules

Good tutorial from Jon Cairns.

Export existing git project to Github/Bitbucket

More details see on How can I export the project in Eclipse to a GitHub repository:

# github
$ git remote add origin git@github.com:<username>/<reponame>.git
# bitbucket
$ git remote add origin https://<username>@bitbucket.org/<username>/<reponame>.git
$ git push -u origin master
Find branch point

Taken from stackoverflow:

$ git log --pretty=oneline master > 1
$ git log --pretty=oneline branch_A > 2
$ git rev-parse `diff 1 2 | tail -1 | cut -c 3-42`^