Bookmark and Share

Configure .gitignore

# use glob syntax
syntax: glob

# specific files
tempfile

# back up files
.DS_Store
._*
*~
.nfs.*
#*#
*.bak
*.old

# logs
derby.log
#derby db
lift_example

# eclipse conf file
#.settings
#.classpath
#.project
.manager

# building
target
build
null
tmp*
temp*
dist
test-output

# Java
*.class

# other scm
.svn
.CVS
.hg*


# use regexp syntax
syntax: regexp
#^\.pc/

Installing more recent Git in Ubuntu 12 than its repositories standardly offer

sudo apt-get install software-properties-common python-software-properties
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git

Alternatively install the other Git-related packages:

sudo apt-get install git-daemon-run git-daemon-sysvinit git-el git-email git-gui gitk gitweb git-arch git-cvs git-mediawiki

help.autoCorrect

There is an auto-correction feature in Git which can be turned on by:

git config --global help.autoCorrect 15

See a terminal session recording: https://showterm.io/189e7798324029948ac3c

I think this is a potentially dangerous feature to use (at least for production purposes) with limited benefit. I decided to not use it. In fact, it's better to set git config --global help.autocorrect 0 to indicate this configuration preference explicitly.

.git/config

Example .git/config file that sets multiple remote repositories. Note the instances of XXX do not ALWAYS represent the same string that need to be replaced by your real-world information.

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
[remote "origin"]
    url = https://XXX@github.com/XXX/XXX.git
    pushurl = https://XXX@github.com/XXX/XXX.git
    pushurl = git@gitlab.com-XXX:XXX/XXX.git
    pushurl = git@bitbucket.org-XXX:XXX/XXX.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[remote "bitbucket"]
    url = git@bitbucket.org-XXX:XXX/XXX.git
    fetch = +refs/heads/*:refs/remotes/bitbucket/*
[remote "gitlab"]
    url = git@gitlab.com-XXX:XXX/XXX.git
    fetch = +refs/heads/*:refs/remotes/gitlab/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
[user]
    name = XXX XXX
    email = XXX@XXX.com

# END
blog comments powered by Disqus