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?
RESOLVEME://files/git-repo-structure.png

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.

2015-01-28

Command line

https://bitbucket.org/USER/REPO#command-line-scratch

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

.gitignore

This works and includes ONLY .gitignore and the subdir:

/*
!/.gitignore
!/subdir/

This does NOT work: subdir is NOT versioned:

*
!/.gitignore
!/subdir/

Reason:

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

[alias]
   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\"`
[branch]
   autosetuprebase = remote
[color]
   branch = auto
   diff = auto
   interactive = auto
   status = auto
   ui = auto
[credential]
   helper = cache --timeout=3600
[diff]
   tool = p4mergetool
[difftool "p4mergetool"]
   cmd = p4merge $LOCAL $REMOTE
[difftool]
   prompt = false
[merge]
   tool = p4mergetool
[mergetool]
   keepTemporaries = false
   prompt = false
[mergetool "p4mergetool"]
   cmd = p4merge $PWD/$BASE $PWD/$LOCAL  $PWD/$REMOTE $PWD/$MERGED
   trustexitcode = false
[push]
   default = simple
[receive]
   denynonfastforwards = true
[user]
   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

Comments

comments powered by Disqus

Previous topic

Nanny

Next topic

Customization options of text roles

Tags

Archives

Languages

Recent Posts

This Page