diff options
-rwxr-xr-x | git/branch.sh | 21 | ||||
-rwxr-xr-x | git/checkout.sh | 26 | ||||
-rwxr-xr-x | git/commit.sh | 58 | ||||
-rwxr-xr-x | git/diff.sh | 29 | ||||
-rwxr-xr-x | git/fetch.sh | 21 | ||||
-rwxr-xr-x | git/gc.sh | 21 | ||||
-rw-r--r-- | git/git-cheatsheet.txt | 72 | ||||
-rwxr-xr-x | git/merge.sh | 43 | ||||
-rw-r--r-- | git/modules | 3 | ||||
-rwxr-xr-x | git/pull.sh | 21 | ||||
-rwxr-xr-x | git/push.sh | 34 | ||||
-rwxr-xr-x | git/rebase.sh | 26 | ||||
-rwxr-xr-x | git/remote.sh | 21 | ||||
-rwxr-xr-x | git/stash.sh | 30 | ||||
-rwxr-xr-x | git/stat.sh | 21 | ||||
-rwxr-xr-x | git/tag.sh | 26 | ||||
-rw-r--r-- | makefile (renamed from git/makefile) | 0 |
17 files changed, 2 insertions, 471 deletions
diff --git a/git/branch.sh b/git/branch.sh deleted file mode 100755 index 14d72dd..0000000 --- a/git/branch.sh +++ /dev/null @@ -1,21 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` - -for i in $modules; do - echo "branch $i" 1>&2 - cd $i - git branch $* - - if [ $? -ne 0 ]; then - echo "branch FAILED" 1>&2 - exit 1 - fi - - cd $wd -done diff --git a/git/checkout.sh b/git/checkout.sh deleted file mode 100755 index 11643c4..0000000 --- a/git/checkout.sh +++ /dev/null @@ -1,26 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` - -if [ "$1" = "" ]; then - echo "branch name expected" 1>&2 - exit 1 -fi - -for i in $modules; do - echo "checkout $i" 1>&2 - cd $i - git checkout $* - - if [ $? -ne 0 ]; then - echo "checkout FAILED" 1>&2 - exit 1 - fi - - cd $wd -done diff --git a/git/commit.sh b/git/commit.sh deleted file mode 100755 index aa96c8c..0000000 --- a/git/commit.sh +++ /dev/null @@ -1,58 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` - -if [ "$1" = "-i" ]; then - add=n -else - add=y -fi - -if [ "$EDITOR" = "" ]; then - echo "no editor specified with the EDITOR variable" 1>&2 - exit 1 -fi - -msg_file=`mktemp -p /tmp` -$EDITOR "$msg_file" - -if [ $? -ne 0 ]; then - echo "$EDITOR failed" 1>&2 - rm -f $msg_file - exit 1 -fi - -if test ! -s "$msg_file"; then - echo "commit message is empty" 1>&2 - rm -f $msg_file - exit 1 -fi - -for i in $modules; do - echo "commit $i" 1>&2 - cd $i - if [ "$add" = "y" ]; then - git add . - - if [ $? -ne 0 ]; then - echo "add FAILED" 1>&2 - exit 1 - fi - - fi - git commit -F $msg_file - -# if [ $? -ne 0 ]; then -# echo "commit FAILED" 1>&2 -# exit 1 -# fi - - cd $wd -done - -rm -f $msg_file diff --git a/git/diff.sh b/git/diff.sh deleted file mode 100755 index bd4639e..0000000 --- a/git/diff.sh +++ /dev/null @@ -1,29 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` - -for i in $modules; do - echo "diff $i" 1>&2 - cd $i - - git --no-pager diff - - if [ $? -ne 0 ]; then - echo "diff FAILED" 1>&2 - exit 1 - fi - - git --no-pager diff --check - - if [ $? -ne 0 ]; then - echo "diff --check FAILED" 1>&2 - exit 1 - fi - - cd $wd -done diff --git a/git/fetch.sh b/git/fetch.sh deleted file mode 100755 index 185d531..0000000 --- a/git/fetch.sh +++ /dev/null @@ -1,21 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` - -for i in $modules; do - echo "fetch $i" 1>&2 - cd $i - git fetch $* - - if [ $? -ne 0 ]; then - echo "fetch FAILED" 1>&2 - exit 1 - fi - - cd $wd -done diff --git a/git/gc.sh b/git/gc.sh deleted file mode 100755 index c12be6f..0000000 --- a/git/gc.sh +++ /dev/null @@ -1,21 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` - -for i in $modules; do - echo "gc $i" 1>&2 - cd $i - git gc - - if [ $? -ne 0 ]; then - echo "gc FAILED" 1>&2 - exit 1 - fi - - cd $wd -done diff --git a/git/git-cheatsheet.txt b/git/git-cheatsheet.txt deleted file mode 100644 index 211e808..0000000 --- a/git/git-cheatsheet.txt +++ /dev/null @@ -1,72 +0,0 @@ -Tag - - git tag -a x.y.z -m "Tag version x.y.z" - -Squash multiple commits into one - - git rebase -i HEAD~<N> - - http://www.gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html - -Change commit message - - git commit --amend - -Revert uncommited changes - - git reset --hard HEAD - -Copy commit from one branch to the other - - # On the source branch - git log -1 - git cout <target-branch> - git cherry-pick <commit-id> - -Setup remote repository - - On remote: - - 1. mkdir proj.git - 2. chgrp scm proj.git - 2. cd proj.git - 3. git --bare init --shared=all - 4. chgrp -R scm ../proj.git - 5. edit description - 5a touch git-daemon-export-ok && chgrp scm git-daemon-export-ok && \ - chmod g+w git-daemon-export-ok # if public - 6. cd hooks - 7. mv post-update.sample post-update - - On local: - - 1. git remote add origin scm.codesynthesis.com:/var/scm/proj/proj.git - 2. git push --tags origin master - 3. # blow the local project and do clone - git clone scm.codesynthesis.com:/var/scm/proj/proj.git [name] - -Delete a branch from a remote repository - - git push origin :experimental - - Find a ref that matches experimental in the origin repository (e.g. - refs/heads/experimental), and delete it. - - Using the push.sh script: - - ./push.sh :<name> - -Rebasing - - Local (e.g., from a feature branch to master): - - git rebase <src> [<dst>] - - If <dst> is not specified, current branch is used. If <dst> is - specified, it is checked out. - - Remote (e.g., merge someone else's changes): - - git fetch - git rebase origin[/master] - git push --tags origin diff --git a/git/merge.sh b/git/merge.sh deleted file mode 100755 index 898a0c0..0000000 --- a/git/merge.sh +++ /dev/null @@ -1,43 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` - -if [ "$1" = "" ]; then - echo "source branch name expected" 1>&2 - exit 1 -fi - -for i in $modules; do - echo "merge $i" 1>&2 - cd $i - - br=`git symbolic-ref -q HEAD` - br=`echo $br | sed -e 's%^refs/heads/%%'` - - # Only allow fast-forward merges into master. - # - if [ "$br" = "master" ]; then - git merge --ff-only $* - else - git merge $* - fi - - if [ $? -ne 0 ]; then - echo 1>&2 - echo "merge FAILED" 1>&2 - echo 1>&2 - - # Merge failures (conflicts) into non-master branches are ok. - # - if [ "$br" = "master" ]; then - exit 1 - fi - fi - - cd $wd -done diff --git a/git/modules b/git/modules index e247ab3..9585305 100644 --- a/git/modules +++ b/git/modules @@ -11,4 +11,5 @@ odb \ examples \ tests \ change \ -etc" +etc \ +git" diff --git a/git/pull.sh b/git/pull.sh deleted file mode 100755 index 07684da..0000000 --- a/git/pull.sh +++ /dev/null @@ -1,21 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` - -for i in $modules; do - echo "pull $i" 1>&2 - cd $i - git pull $* - - if [ $? -ne 0 ]; then - echo "pull FAILED" 1>&2 - exit 1 - fi - - cd $wd -done diff --git a/git/push.sh b/git/push.sh deleted file mode 100755 index d288f3a..0000000 --- a/git/push.sh +++ /dev/null @@ -1,34 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` -br=$1 - -for i in $modules; do - echo "push $i" 1>&2 - cd $i - - if [ -z "$1" ]; then - br=`git symbolic-ref -q HEAD` - br=`echo $br | sed -e 's%^refs/heads/%%'` - fi - - # Also push tags if we are pushing master. - # - if [ "$br" = "master" ]; then - git push --tags origin master - else - git push $ops origin $1 - fi - - if [ $? -ne 0 ]; then - echo "push FAILED" 1>&2 - exit 1 - fi - - cd $wd -done diff --git a/git/rebase.sh b/git/rebase.sh deleted file mode 100755 index 4248048..0000000 --- a/git/rebase.sh +++ /dev/null @@ -1,26 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` - -if [ "$1" = "" ]; then - echo "source branch name expected" 1>&2 - exit 1 -fi - -for i in $modules; do - echo "rebase $i" 1>&2 - cd $i - git rebase $* - - if [ $? -ne 0 ]; then - echo "rebase FAILED" 1>&2 - exit 1 - fi - - cd $wd -done diff --git a/git/remote.sh b/git/remote.sh deleted file mode 100755 index acc1e4a..0000000 --- a/git/remote.sh +++ /dev/null @@ -1,21 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` - -for i in $modules; do - echo "remote $i" 1>&2 - cd $i - git remote $* - - if [ $? -ne 0 ]; then - echo "remote FAILED" 1>&2 - exit 1 - fi - - cd $wd -done diff --git a/git/stash.sh b/git/stash.sh deleted file mode 100755 index 4a3eb99..0000000 --- a/git/stash.sh +++ /dev/null @@ -1,30 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` - -for i in $modules; do - echo "stash $i" 1>&2 - cd $i - - if [ "$1" = "pop" -o "$1" = "apply" ]; then - l=`git stash list` - if [ -z "$l" ]; then - cd $wd - continue - fi - fi - - git stash $* - - if [ $? -ne 0 ]; then - echo "stash FAILED" 1>&2 - exit 1 - fi - - cd $wd -done diff --git a/git/stat.sh b/git/stat.sh deleted file mode 100755 index 5b9ea45..0000000 --- a/git/stat.sh +++ /dev/null @@ -1,21 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` - -for i in $modules; do - echo "stat $i" 1>&2 - cd $i - git status - - if [ $? -ne 0 ]; then - echo "stat FAILED" 1>&2 - exit 1 - fi - - cd $wd -done diff --git a/git/tag.sh b/git/tag.sh deleted file mode 100755 index 935934f..0000000 --- a/git/tag.sh +++ /dev/null @@ -1,26 +0,0 @@ -#! /bin/sh - -# Assume this script never run via PATH. -# -self=`realpath $0` -. `dirname $self`/modules - -wd=`pwd` - -if [ "$1" = "" ]; then - echo "missing version" 1>&2 - exit 1 -fi - -for i in $modules; do - echo "tag $i" 1>&2 - cd $i - git tag -a $1 -m "Tag version $1" - - if [ $? -ne 0 ]; then - echo "tag FAILED" 1>&2 - exit 1 - fi - - cd $wd -done |