| |
_ _
__ _(_) |_ _ _ ___ ___
/ _` | | __| | | | / __|/ _ \
| (_| | | |_ | |_| \__ \ __/
\__, |_|\__| \__,_|___/\___|
|___/
install msysgit
install diffmerge
From c: root
** this will overwrite /st500/software/src **
git clone ssh://myname@192.168.10.203/git/st500.git
Generally, do not "git pull". Instead "git fetch", "git status", "git merge origin/master".
Never "git push" alone. First "git fetch", "git status", "git merge", "git commit".
_ _ __ __
__| (_)/ _|/ _|_ __ ___ ___ _ __ __ _ ___
/ _` | | |_| |_| '_ ` _ \ / _ \ '__/ _` |/ _ \
| (_| | | _| _| | | | | | __/ | | (_| | __/
\__,_|_|_| |_| |_| |_| |_|\___|_| \__, |\___|
|___/
Tested:
git config --global merge.tool diffmerge
git config --global mergetool.diffmerge.cmd "diffmerge --merge --result=$MERGED $LOCAL $BASE $REMOTE"
(Above does not work on linux)
git config --global mergetool.diffmerge.trustexitcode false
git config --global diff.tool diffmerge
git config --global difftool.diffmerge.cmd "diffmerge $LOCAL $REMOTE"
(Above does not work on linux)
Tested to work on linux (use "git difftool"):
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
_
___ ___ _ __ ___ _ __ __ _ _ __(_)___ ___ _ __
/ __/ _ \| '_ ` _ \| '_ \ / _` | '__| / __|/ _ \| '_ \
| (_| (_) | | | | | | |_) | (_| | | | \__ \ (_) | | | |
\___\___/|_| |_| |_| .__/ \__,_|_| |_|___/\___/|_| |_|
|_|
Most Basic:
git fetch
git status
git fetch
gitk --all
git push --dry-run
"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..branch
"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
_ _ _
___ ___ _ ____ _____ _ __ (_)_ __ (_) |_
/ __|/ _ \ '__\ \ / / _ \ '__| | | '_ \| | __|
\__ \ __/ | \ V / __/ | | | | | | | |_
|___/\___|_| \_/ \___|_| |_|_| |_|_|\__|
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
_
___| | ___ __ _ _ __ _ _ _ __
/ __| |/ _ \/ _` | '_ \| | | | '_ \
| (__| | __/ (_| | | | | |_| | |_) |
\___|_|\___|\__,_|_| |_|\__,_| .__/
|_|
"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-07-14
|