Oct 30, 2014 Tags: Git, QandA
Things I want to keep: How do I use Git and services like Github?
Updated on Jun 29, 2015
See also
Navigate this page:
A very well written explanation and howto by David Baumgold. Noted 2014-10-30.
Bitbucket has good documentation.
2015-01-28
https://bitbucket.org/USER/REPO#command-line-scratch
Set up Git on local machine:
Complete walkthrough: https://confluence.atlassian.com/x/cgozDQ
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
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:
/*
!/.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.
[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