_               _                 _               
| |__   __ _ ___(_) ___   ___  ___| |_ _   _ _ __  
| '_ \ / _` / __| |/ __| / __|/ _ \ __| | | | '_ \ 
| |_) | (_| \__ \ | (__  \__ \  __/ |_| |_| | |_) |
|_.__/ \__,_|___/_|\___| |___/\___|\__|\__,_| .__/ 
                                            |_|    


Linux:

apt-get install git-core
apt-get install gitk
apt-get install git-gui

apt-get install openssh-server

create user myname, with group ggit
create directory /git

$ git init --bare --shared foorepo.git
Initialized empty shared Git repository in /git/foorepo.git/
$ chgrp -R ggit foorepo.git

Windows:

git push --tags ssh://myname@192.168.10.122/git/foorepo.git master
myname@192.168.10.122's password:
Counting objects: 28018, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (6215/6215), done.
Writing objects: 100% (28018/28018), 47.24 MiB | 7.34 MiB/s, done.
Total 28018 (delta 16793), reused 28018 (delta 16793)
To ssh://myname@192.168.10.122/git/foorepo.git
 * [new branch]      master -> master


Wherever:

git clone ssh://myname@192.168.10.122/git/foorepo.git




     _ _  __  __                               
  __| (_)/ _|/ _|_ __ ___   ___ _ __ __ _  ___ 
 / _` | | |_| |_| '_ ` _ \ / _ \ '__/ _` |/ _ \
| (_| | |  _|  _| | | | | |  __/ | | (_| |  __/
 \__,_|_|_| |_| |_| |_| |_|\___|_|  \__, |\___|
                                    |___/      

Tested:
 
git config --global merge.tool diffmerge

git config --global mergetool.diffmerge.cmd "diffmerge --merge --result=$MERGED $LOCAL $BASE $REMOTE"

git config --global mergetool.diffmerge.trustexitcode false

git config --global diff.tool diffmerge

git config --global difftool.diffmerge.cmd "diffmerge $LOCAL $REMOTE"




Not Tested:

git config --global mergetool.diffmerge.cmd "diffmerge --merge --result=\$MERGED \$LOCAL \$BASE \$REMOTE"

git config --global mergetool.diffmerge.trustExitCode true


As of the 3.3 release of Diffmerge, exiting a visual merge will return the
correct status to Git. Prior to this release, Diffmerge would always return 0,
indicating that the merge was resolved even on aborted merges. When you attempt
to close Diffmerge, you will be prompted to choose if the merge is to be
aborted or is resolved.

To start a 3-way merge with your visual mergetool, run:

git mergetool

This will perform a visual merge for each file in conflict. You may also
provide an optional file parameter, to perform a merge on a specific file.

Donít store backups

By default, Git will store a backup of the original file with conflict markers
after a successful merge. These files will have a .orig extension added to the
original filename. When I configure Git, I ensure that these files are not
saved. To globally disable backups of the original merge file, run the
following:

git config --global mergetool.keepBackup false

Visual Difftool Configuration

You may also setup Diffmerge to be your visual Difftool by running the
following commands in your terminal:

git config --global diff.tool diffmerge

git config --global difftool.diffmerge.cmd "diffmerge \$LOCAL \$REMOTE"

This will allow you to compare two different versions of files visually. For example:

git difftool master~1 foo.rb




                                      _                 
  ___ ___  _ __ ___  _ __   __ _ _ __(_)___  ___  _ __  
 / __/ _ \| '_ ` _ \| '_ \ / _` | '__| / __|/ _ \| '_ \ 
| (_| (_) | | | | | | |_) | (_| | |  | \__ \ (_) | | | |
 \___\___/|_| |_| |_| .__/ \__,_|_|  |_|___/\___/|_| |_|
                    |_|                                 


"I want to merge two branches that have been separated for a while and wanted to
know which files have been modified."

$ git diff --name-status master..branch

$ git diff --stat --color master..branchName

"shows you commits that are in mybranch, but not in origin/mybranch"
git log origin/mybranch..mybranch

http://stackoverflow.com/questions/822811/differences-in-git-branches




      _                              
  ___| | ___  __ _ _ __  _   _ _ __  
 / __| |/ _ \/ _` | '_ \| | | | '_ \ 
| (__| |  __/ (_| | | | | |_| | |_) |
 \___|_|\___|\__,_|_| |_|\__,_| .__/ 
                              |_|    


"I have a repository with 5 years worth of history, I only want to keep 1 year,
so I want to purge the first 4 years. As it happens, the repository only has a
single branch which should simplify the problem. Cheers, Geoff Russell"

Use filter-branch to drop the parents on the first commit you want to 
keep, and then drop the old cruft. 

Let's say $drop is the hash of the latest commit you want to drop. To keep
things sane and simple, make sure the first commit you want to keep, ie. the
child of $drop, is not a merge commit. Then you can use: 

git filter-branch --parent-filter "sed -e 's/-p $drop//'" \ 
        --tag-name-filter cat -- \ 
        --all ^$drop 

The above rewrites the parents of all commits that come "after" $drop. 

Then clone that repo to shrink it.



http://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html
http://git.661346.n2.nabble.com/purging-unwanted-history-td1507638.html




              _                 _                        
 _ __ ___  __| |_   _ _ __   __| | __ _ _ __   ___ _   _ 
| '__/ _ \/ _` | | | | '_ \ / _` |/ _` | '_ \ / __| | | |
| | |  __/ (_| | |_| | | | | (_| | (_| | | | | (__| |_| |
|_|  \___|\__,_|\__,_|_| |_|\__,_|\__,_|_| |_|\___|\__, |
                                                   |___/ 


====================
Personal Repo Backup
====================

"The way I do this is to create a remote (bare) repository (on a separate drive,
USB Key, backup server or even github) and then use push --mirror to make that
remote repo look exactly like my local one (except the remote is a bare
repository)."

http://stackoverflow.com/questions/2129214/backup-a-local-git-repository


=============================
Central Repo Automatic Backup
=============================

In order to do a "git pull" in a Scheduled Task we need ssh to not ask for a
password. This is called "ssh forwarding" or "ssh agent forwarding".  Do the
following steps after everything else is working: the repo has been properly
cloned, and pulls work but require a password.

On the client, in the git-bash shell:

ssh-keygen -t rsa 

"cd ~/.ssh" and "ls" to make sure the files are there

Use scp to copy C:\My Documents\.ssh\id_rsa.pub to /home/myname on the server.

mkdir .ssh on server (e.g. /home/myname/.ssh)

cat id_rsa.pub >> .ssh/authorized_keys


http://www.debian-administration.org/articles/152
http://serverfault.com/questions/224810/is-there-an-equivalent-to-ssh-copy-id-for-windows








Kent Stork 2011-06-21