Oct 30, 2014 Tags: Git, QandA

Using Git

Things I want to keep: How do I use Git and services like Github?

Updated on Jun 29, 2015

Navigate this page:

Questions and Answers

How to Rebase a Pull Request?

A very well written explanation and howto by David Baumgold. Noted 2014-10-30.

How to revert a pushed commit at Github?
No, currently there is no simple button in the Github web interface that let’s you revert the latest push directly. Instead, read what Dave King is writing here. Noted 2014-06-20.
Git and TYPO3: How to edit a pull request before pushing it?
A useful discussion at Github. Noted 2014-06-20.
What can I learn from Bitbucket?

Bitbucket has good documentation.


Command line


Set up Git on local machine:

Complete walkthrough: https://confluence.atlassian.com/x/cgozDQ

Starting from Scratch

Set up local directory:

mkdir /path/to/project
cd /path/to/project
git init
git remote add origin git@bitbucket.org:USERNAME/REPONAME.git

# If filemode is not to be stored in the repo:
git config core.filemode false

Create first file, commit and push:

touch .gitignore
git add .gitignore
git commit -m 'Initial commit with .gitignore'
git push -u origin master

Starting from existing project

Push it:

cd /path/to/my/repo
git remote add origin git@bitbucket.org:USER/REPO.git
git push -u origin --all # pushes up the repo and its refs for the first time
git push -u origin --tags # pushes up any tags


This works and includes ONLY .gitignore and the subdir:


This does NOT work: subdir is NOT versioned:



An optional prefix ”!” which negates the pattern; any matching file excluded by a previous pattern will become included again. It is not possible to re-include a file if a parent directory of that file is excluded.

My .gitconfig

   diffns = diff --name-status
   br = branch
   ci = commit
   co = checkout
   last = log -1 HEAD
   ln = log --graph --pretty=oneline --abbrev-commit
   lognice = log --graph --pretty=oneline --abbrev-commit
   st = status
   datetag = !git tag dt-`date \"+%Y-%m-%d-%H-%M\"`
   autosetuprebase = remote
   branch = auto
   diff = auto
   interactive = auto
   status = auto
   ui = auto
   helper = cache --timeout=3600
   tool = p4mergetool
[difftool "p4mergetool"]
   cmd = p4merge $LOCAL $REMOTE
   prompt = false
   tool = p4mergetool
   keepTemporaries = false
   prompt = false
[mergetool "p4mergetool"]
   cmd = p4merge $PWD/$BASE $PWD/$LOCAL  $PWD/$REMOTE $PWD/$MERGED
   trustexitcode = false
   default = simple
   denynonfastforwards = true
   email = martin@mbless.de
   name = Martin Bless
[url "ssh://marble@review.typo3.org:29418"]
   pushInsteadOf = git://git.typo3.org

[color "branch"]
   current = yellow reverse
   local = yellow
   remote = green
[color "diff"]
   meta = yellow bold
   frag = magenta bold
   old = red bold
   new = green bold
[color "status"]
   added = yellow
   changed = green
   untracked = cyan

Previous topic


Next topic

Customization options of text roles




Recent Posts

This Page