Mercurial > dotfiles
annotate .shell.d/50.git_functions.sh @ 217:e4842709368a
emacs: move colors to their own file and migrate to whitespace from wspace
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Sat, 14 Aug 2010 20:42:58 -0500 |
parents | 0590f34b92a0 |
children | 0cd241f35c40 |
rev | line source |
---|---|
210
0590f34b92a0
shell.d: split hg and git functions out of vcs functions
Augie Fackler <durin42@gmail.com>
parents:
204
diff
changeset
|
1 # git utility functions |
0 | 2 |
156
59ea03d7029a
vcs_functions: add a function to grab the path of the next unmerged file from git
Augie Fackler <durin42@gmail.com>
parents:
133
diff
changeset
|
3 function git_next_unmerged_file() { |
195
e1a49db5c6ff
git-next-unmerged-file: also include "both modified" files
Augie Fackler <durin42@gmail.com>
parents:
184
diff
changeset
|
4 git status | egrep '(unmerged|both modified)' | head -n 1 | sed 's/.*: //' |
156
59ea03d7029a
vcs_functions: add a function to grab the path of the next unmerged file from git
Augie Fackler <durin42@gmail.com>
parents:
133
diff
changeset
|
5 } |
59ea03d7029a
vcs_functions: add a function to grab the path of the next unmerged file from git
Augie Fackler <durin42@gmail.com>
parents:
133
diff
changeset
|
6 alias git-next-unmerged-file=git_next_unmerged_file |
59ea03d7029a
vcs_functions: add a function to grab the path of the next unmerged file from git
Augie Fackler <durin42@gmail.com>
parents:
133
diff
changeset
|
7 |
204
9e45ac5350fd
vcs funcs: tools for verifying hg or git repos, packing git repos
Augie Fackler <durin42@gmail.com>
parents:
200
diff
changeset
|
8 function git_repack_all() { |
9e45ac5350fd
vcs funcs: tools for verifying hg or git repos, packing git repos
Augie Fackler <durin42@gmail.com>
parents:
200
diff
changeset
|
9 for repo in $(find . | \ |
9e45ac5350fd
vcs funcs: tools for verifying hg or git repos, packing git repos
Augie Fackler <durin42@gmail.com>
parents:
200
diff
changeset
|
10 grep '/objects/pack/' | \ |
9e45ac5350fd
vcs funcs: tools for verifying hg or git repos, packing git repos
Augie Fackler <durin42@gmail.com>
parents:
200
diff
changeset
|
11 sed -e 's%\.git/objects/pack/.*%%' | \ |
9e45ac5350fd
vcs funcs: tools for verifying hg or git repos, packing git repos
Augie Fackler <durin42@gmail.com>
parents:
200
diff
changeset
|
12 sed -e 's%git/objects/pack/.*%git%' | sort | uniq) ; do |
9e45ac5350fd
vcs funcs: tools for verifying hg or git repos, packing git repos
Augie Fackler <durin42@gmail.com>
parents:
200
diff
changeset
|
13 pushd $repo |
9e45ac5350fd
vcs funcs: tools for verifying hg or git repos, packing git repos
Augie Fackler <durin42@gmail.com>
parents:
200
diff
changeset
|
14 git repack -ad --window 100 |
9e45ac5350fd
vcs funcs: tools for verifying hg or git repos, packing git repos
Augie Fackler <durin42@gmail.com>
parents:
200
diff
changeset
|
15 git gc --prune="`date`" |
9e45ac5350fd
vcs funcs: tools for verifying hg or git repos, packing git repos
Augie Fackler <durin42@gmail.com>
parents:
200
diff
changeset
|
16 popd |
9e45ac5350fd
vcs funcs: tools for verifying hg or git repos, packing git repos
Augie Fackler <durin42@gmail.com>
parents:
200
diff
changeset
|
17 done |
9e45ac5350fd
vcs funcs: tools for verifying hg or git repos, packing git repos
Augie Fackler <durin42@gmail.com>
parents:
200
diff
changeset
|
18 } |
9e45ac5350fd
vcs funcs: tools for verifying hg or git repos, packing git repos
Augie Fackler <durin42@gmail.com>
parents:
200
diff
changeset
|
19 |
9e45ac5350fd
vcs funcs: tools for verifying hg or git repos, packing git repos
Augie Fackler <durin42@gmail.com>
parents:
200
diff
changeset
|
20 function git_fsck_all() { |
9e45ac5350fd
vcs funcs: tools for verifying hg or git repos, packing git repos
Augie Fackler <durin42@gmail.com>
parents:
200
diff
changeset
|
21 for repo in $(find . | \ |
9e45ac5350fd
vcs funcs: tools for verifying hg or git repos, packing git repos
Augie Fackler <durin42@gmail.com>
parents:
200
diff
changeset
|
22 grep '/objects/pack/' | \ |
9e45ac5350fd
vcs funcs: tools for verifying hg or git repos, packing git repos
Augie Fackler <durin42@gmail.com>
parents:
200
diff
changeset
|
23 sed -e 's%\.git/objects/pack/.*%%' | \ |
9e45ac5350fd
vcs funcs: tools for verifying hg or git repos, packing git repos
Augie Fackler <durin42@gmail.com>
parents:
200
diff
changeset
|
24 sed -e 's%git/objects/pack/.*%git%' | sort | uniq) ; do |
9e45ac5350fd
vcs funcs: tools for verifying hg or git repos, packing git repos
Augie Fackler <durin42@gmail.com>
parents:
200
diff
changeset
|
25 pushd $repo |
9e45ac5350fd
vcs funcs: tools for verifying hg or git repos, packing git repos
Augie Fackler <durin42@gmail.com>
parents:
200
diff
changeset
|
26 git fsck |
9e45ac5350fd
vcs funcs: tools for verifying hg or git repos, packing git repos
Augie Fackler <durin42@gmail.com>
parents:
200
diff
changeset
|
27 popd |
9e45ac5350fd
vcs funcs: tools for verifying hg or git repos, packing git repos
Augie Fackler <durin42@gmail.com>
parents:
200
diff
changeset
|
28 done |
9e45ac5350fd
vcs funcs: tools for verifying hg or git repos, packing git repos
Augie Fackler <durin42@gmail.com>
parents:
200
diff
changeset
|
29 } |