Git

Hosting

 * http://gitorious.org/about
 * http://github.com

Submodules
$ git submodule add host:/Dir/repo.git $ git clone superproject $ git submodule init $ git submodule update
 * http://woss.name/2008/04/09/using-git-submodules-to-track-plugins/
 * http://ssteiner.wordpress.com/2008/12/30/git-subprojects/
 * https://git.wiki.kernel.org/index.php/SubprojectSupport
 * http://book.git-scm.com/5_submodules.html
 * 1) add to your super repo
 * 1) clone the super and all submodules

SVN

 * http://www.kernel.org/pub/software/scm/git/docs/git-svn.html#_basic_examples
 * http://stackoverflow.com/questions/190431/is-git-svn-dcommit-after-merging-in-git-dangerous

Merging

 * http://stackoverflow.com/questions/161813/how-do-i-fix-merge-conflicts-in-git
 * http://book.git-scm.com/3_basic_branching_and_merging.html
 * http://weblog.masukomi.org/2008/07/12/handling-and-avoiding-conflicts-in-git

Unadding
$ git reset FILE $ git reset HEAD file $ git reset $ git rm -r --cached
 * http://stackoverflow.com/questions/348170/undo-git-add

git config --global alias.unadd "reset HEAD"
 * http://pivotallabs.com/users/alex/blog/articles/1001-git-unadd

Clients

 * http://www.git-tower.com/
 * http://www.syntevo.com/smartgit/index.html
 * http://www.gittiapp.com/
 * http://gitx.frim.nl/

Use Cases
$ git reset
 * I added a file to the index, haven't committed it yet and would like to remove it from the index

Repos

 * http://qt.gitorious.org/qt/qt-script-ng

Updating a Commit Message
// not having pushed yet git commit --amend -m "new message"
 * http://stackoverflow.com/questions/179123/how-do-i-edit-an-incorrect-commit-message-in-git

Git Config
[user] name = First Last email = username@mydomain.com
 * http://stackoverflow.com/questions/267761/what-does-your-gitconfig-contain

[color] diff = auto status = auto branch = auto interactive = auto ui = true pager = true

[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

[core] pager = less -FRSX whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol

[alias] co = checkout [github] user = github username token = github API token

Trivial Server
git remote add imac19 imac19:/Volumes/mount/repo/module/project.git
 * http://book.git-scm.com/3_distributed_workflows.html
 * http://book.git-scm.com/4_setting_up_a_private_repository.html

Clients

 * http://www.syntevo.com/smartgit/index.html
 * http://www.git-tower.com/
 * http://stackoverflow.com/questions/455698/best-visual-client-for-git-on-mac-os-x

FAQ
$ git reset --hard
 * I've made some local changes that I'm not interested in keeping around anymore. I want to start over from the last commit.

Concepts

 * index: a sort of staging area. The index know about which files you'd like to commit. The index is a sort of metastore. You add files to the index before committing them. Resetting the index does not alter the actual files themselves - it simply updates their information as included in the 'index'
 * working tree: the area in which your files actually live. Generally, if you edit a file under source control, you have edited your working tree. You have not necessarily added that file to the index nor must the file exist in your repository either. The 'working tree' simply denotes the actual files you are working on.
 * repository: on a commit, files noted in the index are copied from the working tree and merged into the repository (obviously much more complicated)

Overview

 * https://37s.backpackit.com/pub/1465067
 * Everyday GIT with 20 Commands or So
 * Git - SVN Crash Course
 * http://nvie.com/git-model Git Model
 * http://www.newartisans.com/2008/04/git-from-the-bottom-up.html
 * http://progit.org/
 * https://git.wiki.kernel.org/index.php/GitSvnCrashCourse
 * http://stackoverflow.com/questions/267761/what-does-your-gitconfig-contain
 * http://programmers.stackexchange.com/questions/35074/im-a-subversion-geek-why-i-should-consider-or-not-consider-mercurial-or-git-or

Git Grep
"Finding files with words or phrases in Git is really easy with the git grep command. It is possible to do this with the normal unix 'grep' command, but with 'git grep' you can also search through previous versions of the project without having to check them out."
 * http://book.git-scm.com/4_finding_with_git_grep.html

Clients

 * http://www.git-tower.com/

Gitignore
~/.gitglobalignores

SSH
ssh-add ~/.ssh/id_rsa_client
 * http://help.github.com/multiple-keys/

Common Steps
Getting started: $ cd $GITROOT/.../projecthome/projectversion-1.0.0.git $ git init --bare $ cd $PROJECT $ git init $ git add. --dry-run  # test what would be added $ vi .gitignore        # remove files you don't want added $ git add -f .gitignore # force add (.gitignore often includes .*) $ git add. --dry-run  # keep editing .gitignore $ git add. # add and proceed $ git commit -a -m "Initial commit." $ git remote add origin $ git push origin master

Sample .gitignore for an Xcode project: build .*
 * .mode1v3
 * .pbxuser

checking out a remote branch
git checkout -b [new_branch] origin/[new_branch]
 * http://www.wetware.co.nz/blog/2009/07/pull-a-git-branch-from-remote/

config
I looks like the probleme was ssh not reading .bash_profile What I had to do is write export PATH=$PATH:/usr/local/bin in .bashrc instead since ssh reads that file. "Many installations of sshd do not invoke your shell as the login shell when you directly run programs; what this means is that if your login shell is bash, only .bashrc is read and not .bash_profile. As a workaround, make sure .bashrc sets up $PATH so that you can run git-receive-pack program." $ git commit -m "Initial commit." [master (root-commit) d8515e7] Initial commit. Committer: U-HOSTNAME\luther.baker  Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly:
 * http://superuser.com/questions/38815/git-receive-pack-command-not-found
 * http://www.bluestatic.org/blog/2007/08/01/git-public-push-ing/
 * http://www.n8williams.com/devblog/general_dev/bash-git-receive-pack-command-not-found

git config --global user.name "Your Name" git config --global user.email you@example.com

If the identity used for this commit is wrong, you can fix it with:

git commit --amend --author='Your Name '

24 files changed, 2894 insertions(+), 0 deletions(-)

tuts

 * http://www-cs-students.stanford.edu/~blynn/gitmagic/ch05.html

git show-branch

 * git show-branch
 * Understanding the output of git show-branch

installing locally
git clone git://git.kernel.org/pub/scm/git/git.git git clone http://www.kernel.org/pub/scm/git/git.git  # if behind a firewall "Either way, all you'll have to do is make install - the default prefix is $HOME, placing files in $HOME/bin, $HOME/libexec, and so on. If you want to keep it partitioned (a good idea, since there's no uninstall rule), just use the prefix option, e.g. make prefix=$HOME/git."
 * http://stackoverflow.com/questions/2647484/installing-git-in-home-directory-centos-5-no-root

Forums
$ git branch -a $ git checkout. $ git reset $ git reset --hard $ git revert ... $ git clean -f
 * http://stackoverflow.com/questions/67699/how-do-i-clone-all-remote-branches-with-git
 * http://stackoverflow.com/questions/1146973/how-to-revert-all-local-changes-in-a-git-managed-project-to-previous-state

Links

 * http://www.kernel.org/pub/software/scm/git/docs/git-rebase.html
 * http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#fixing-a-mistake-by-rewriting-history
 * http://www.gitready.com/intermediate/2009/01/31/intro-to-rebase.html
 * http://stackoverflow.com/questions/307828/git-remove-file-accidentally-added-to-the-repository
 * http://stackoverflow.com/questions/3528804/how-to-commit-after-removing-a-directory-from-git
 * http://stackoverflow.com/questions/1216733/remove-a-directory-permanently-from-git
 * Permanently remove files and folders from a git repository
 * http://lists-archives.org/git/638777-can-t-commit-files-that-have-been-git-add-ed-because-fatal-you-need-to-resolve-your-current-index-first.html

Github
Page does not exist! Read the Full Documentation Instructions for setting up username.github.com *
 * http://develop.github.com/p/users.html
 * http://help.github.com/troubleshooting-ssh/
 * http://help.github.com/git-email-settings/

Create a repo named username.github.com Push a `master` branch to GitHub and enjoy!

Instructions for setting up username.github.com/repo-name * Caution: make your working directory clean before you do this (either stash or commit), otherwise this will lose any changes you've made to your project since the last commit.

cd /path/to/repo-name git symbolic-ref HEAD refs/heads/gh-pages rm .git/index git clean -fdx echo "My GitHub Page" > index.html git add. git commit -a -m "First pages commit" git push origin gh-pages

Remote Server
ssh git@REMOTE_SERVER
 * http://blog.commonthread.com/2008/4/14/setting-up-a-git-server
 * 1) login to remote server

mkdir example.git cd example.git git --bare init
 * 1) once logged in

mkdir example cd example git init touch README git add README git commit -m 'first commit' git remote add origin git@REMOTE_SERVER:example.git git push origin master
 * 1) upload files