Compare commits

...

1334 commits
v2.1.0 ... main

Author SHA1 Message Date
dependabot[bot] 4cf28ec559
chore(deps): bump actions/stale from 10 to 11 (#1265)
Some checks failed
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / Test with Bats (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
Signed-off-by: dependabot[bot] <support@github.com>
2026-09-01 12:25:44 -07:00
罗泽轩 09b77e8ed6
ci: add generated manuals check (#1268)
Some checks failed
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / Test with Bats (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2026-08-27 13:59:29 +08:00
Vijay Misal 4c38988ba9
feat(mr): support Forgejo/Codeberg pull request URLs (#1267)
* feat(mr): support Forgejo/Codeberg pull request URLs

Codeberg and other Forgejo instances expose pull requests under
refs/pull/<id>/head instead of GitLab's refs/merge-requests/<id>/head,
so passing a Codeberg pull request URL to git mr fetched the wrong
ref. Recognize the /pulls/<id> URL shape and switch to the matching
ref for that case, leaving the GitLab URL and bare numeric id
behavior unchanged.

Closes #1213

* test(git-mr): cover Forgejo/Codeberg URLs, regenerate man docs

Add a bats test that exercises the pulls URL branch via a local
insteadOf remote rewrite (no real HTTP endpoint needed), and bring
git-mr.1/git-mr.html in line with the git-mr.md changes.

---------

Co-authored-by: vjymisal0 <vijay.looprai@gmail.com>
2026-08-27 13:59:00 +08:00
Vijay Misal dbf68bac59
fix(is-git-repo): recognize bare repositories (#1266)
* fix(is-git-repo): recognize bare repositories

is_git_repo() used `git rev-parse --show-toplevel` to detect whether
the current directory is inside a git repository. --show-toplevel
fails for bare repositories since they have no working tree, so every
command that relies on this shared helper (e.g. `git browse`) reports
"Not a git repo!" when run from inside a bare repo, even though it
plainly is one.

Switch to `git rev-parse --git-dir`, which succeeds for both normal
and bare repositories and keeps the existing "not a repo" behavior
for non-repo directories.

Fixes #1238, reported and LGTM'd by maintainers there with this exact
fix; no PR had been opened for it yet.

Adds tests/is-git-repo.bats covering: a normal repo, a bare repo, and
a plain (non-repo) directory.

* Fix ruff lint failures in scripts/checkstyle.py

This PR's new Ruff CI job surfaced pre-existing style issues (unsorted
imports, deprecated typing.List/Dict, nested ifs, bare exit()) in
checkstyle.py. Cleaned these up so the newly added lint job passes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-17 14:15:48 +08:00
dependabot[bot] 03569856db
chore(deps): bump actions/setup-python from 6 to 7 (#1263)
* chore(deps): bump actions/setup-python from 6 to 7

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 6 to 7.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix lints

* Fix typo

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Edwin Kofler <edwin@kofler.dev>
Co-authored-by: spacewander <spacewanderlzx@gmail.com>
2026-08-14 12:27:16 +08:00
罗泽轩 d11e45f0b1
port python tests to bats (#1264)
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2026-08-12 15:43:59 +08:00
dependabot[bot] fd2e03cf55
chore(deps): bump actions/setup-go from 6 to 7 (#1262)
Signed-off-by: dependabot[bot] <support@github.com>
2026-07-19 18:52:47 -07:00
AJ Côté 5a14757944
feat(scp): add verbose, interactive, and dry-run flags (#1261)
* feat(scp): add -v/--verbose and -i/--interactive flags

git scp/git rscp printed a diff via plain `git diff`/`git diff --stat`
with no `--no-pager` and no TTY check, blocking on the user's pager.
Add -v/--verbose to print the diff via --no-pager before syncing, and
-i/--interactive to also prompt for confirmation before the real
push/copy. Both apply to git scp and git rscp, and must precede
<remote>.

Updates man/git-scp.md and Commands.md.

* feat(scp): add -n/--dry-run flag

Add -n/--dry-run to preview a sync without changing anything: rsync
runs with -n, and git add --force / ssh ... rm are skipped outright.
Implies --verbose, since confirming or previewing with nothing shown
is useless.

Also restructures scp_and_stage's push/delete blocks from `&&`-chains
into if/then, needed to branch on dry-run, which incidentally fixes a
latent bug where a non-TTY COLOR_RESET could silently skip the real
rsync/git add/ssh rm calls.

Updates man/git-scp.md and Commands.md.

* test(scp): add coverage for -n/--dry-run and -i/--interactive abort

git-scp had no test coverage at all. Cover the two paths that need no
real remote destination: dry-run must preview without touching the
index, working tree, or remote path, and declining the interactive
confirmation must abort before anything syncs.

* feat(scp): Code review

* feat(scp): Code review
2026-07-14 19:43:00 +08:00
kdergachev b450b36036
Added edit/remove functionality to git-ignore (#1258)
* Added edit/remove functionality to git-ignore.

* Minor change to array-string assignment.

* Fixes array handling for remove.

* Suggested fixes (iteration over arguments, pattern removal, editor handling, tmp file location, symlinked gitignore handling).

* Changed pure bash editing of files to an awk script. Some other minor cosmetic changes.

* Updated docs.

* Modified autocomplete to work with new git-ignore

* Added help message to git-ignore.

* Added help flags to git-ignore's man.

* Made $file in eval safe. Should not do the same for editor since then all of the GIT_EDITOR will be treated as command (flags included).

* Typo fixes.
2026-07-14 19:42:02 +08:00
Acho Arnold 7f36d37283
fix: support Windows ARM64 (clangarm64) in install.cmd (#1259)
Some checks failed
ci / Test with Bats (push) Has been cancelled
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / Test with Pytest (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
* fix: support Windows ARM64 (clangarm64) in install.cmd

Git for Windows on ARM64 uses a `clangarm64` directory instead of
`mingw64`. The installer now auto-detects `clangarm64` when
`mingw64` is not present, so it works out of the box on ARM64
Windows machines without requiring the user to manually supply
the path.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: remove trailing whitespace from install.cmd

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* fix: correctly resolve PREFIX when git.exe is under the arch dir in PATH

When 'where git.exe' resolves to ...\mingw64\bin\git.exe or
...\clangarm64\bin\git.exe, installdir becomes the architecture directory
itself. Detect that case by inspecting the leaf directory name instead of
appending mingw64/clangarm64 (which produced non-existent ...\mingw64\mingw64
paths) or using ..\ segments.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-07-08 15:20:25 +08:00
dependabot[bot] 184d37e980
chore(deps): bump actions/checkout from 6 to 7 (#1260)
Some checks failed
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / Test with Pytest (push) Has been cancelled
ci / Test with Bats (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-22 14:05:50 +08:00
Utsav Sabharwal e92878b81b
feat: add git-delete-gone-branches command (#1239)
* feat: add git-delete-gone-branches command

Adds a new command to delete local branches whose remote-tracking
branch has been deleted (shown as [gone] in git branch -vv).

This is a common need after PRs are merged and remote branches are
cleaned up, leaving stale local branches behind.

Features:
- Deletes all local branches with a gone remote in one command
- --dry-run / -n flag to preview branches before deletion

Closes #1220

* Address PR review feedback on git-delete-gone-branches

- Use git for-each-ref instead of git branch -vv to avoid false
  positives from commit messages containing ': gone]'
- Add interactive confirmation prompt by default; skip with -f/--force
- Add -p/--prune flag to run git fetch --prune before checking
- Add generated man page .1 and .html files

* Use GitHub profile for author contact in man page

* Fix gone-branch detection with nobracket format
2026-06-09 10:36:27 +08:00
罗泽轩 b9e1d88f2c
doc: regenerate git-extras.1 (#1255)
This file has been reset since commit 032090e847

Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2026-05-26 12:28:42 +08:00
Ricardo Fernández Serrata 99207eee8e
refactor(delete-merged-branches): rm -n1 from xargs, fmt pipes (#1233) 2026-05-18 16:10:46 +08:00
罗泽轩 9d6319becb
Bump git-extras version to 7.6.0-dev (#1251) 2026-05-11 09:49:38 +08:00
罗泽轩 2bdeb59a73
Version 7.5.0 (#1250)
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2026-05-10 10:19:14 +08:00
Russ c5a0fdf660
Use standard prefix for home dir installs (#1248) 2026-04-29 13:46:32 -07:00
Ricardo Fernández Serrata 8d1c970031
refactor(abort): common gitdir (#1244)
* refactor(abort): common gitdir

* un-readonly
2026-04-14 13:26:28 +08:00
罗泽轩 c06fad59d2
Fix man page usage docs (#1241) 2026-03-23 23:21:26 -07:00
phanium 65dd36ae62
Fix git-changelog to handle whitespace in command arguments (#1232) 2026-03-05 23:06:10 -08:00
dependabot[bot] 967e339f91
chore(deps): bump bats-core/bats-action from 3.0.1 to 4.0.0 (#1230)
Bumps [bats-core/bats-action](https://github.com/bats-core/bats-action) from 3.0.1 to 4.0.0.
- [Release notes](https://github.com/bats-core/bats-action/releases)
- [Commits](https://github.com/bats-core/bats-action/compare/3.0.1...4.0.0)

---
updated-dependencies:
- dependency-name: bats-core/bats-action
  dependency-version: 4.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-09 14:36:15 +08:00
罗泽轩 ae3d30fb6e
add details when multiple active operations found (#1229)
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2026-02-06 15:03:50 +08:00
John Bachir 032090e847
Add persistent history to git-repl (#1226)
* persistent command history

* notes

* decision on which commands to save

* configurable history location

* fix history initialization in various scenarios

* documentation

* comment

* don't add whitespace or consecutive duplicates to history

* fix manpage output

* Update bin/git-repl

Co-authored-by: Edwin Kofler <edwin@kofler.dev>

* Update bin/git-repl

Co-authored-by: Edwin Kofler <edwin@kofler.dev>

* Update git-repl

* Update bin/git-repl

* Apply suggestions from code review

* Add `extglob` and generate docs

* Fix regex

* update docs

rm man/git-repl.{1,html}
touch man/git-repl.md
make man/git-repl.{1,html}

---------

Co-authored-by: Edwin Kofler <edwin@kofler.dev>
2026-02-05 11:05:01 -08:00
Erik Skultety 5367101f2e
Support passing ref to git-commits-since (#1228) 2026-02-02 21:39:48 -08:00
John Bachir 6ed2643252
ability to specify command when hitting enter (#1223)
* ability to specify command when hitting enter

* documentation

* man page

* generate man page and html

* run default command through same logic as other commands

impetuous: persist return val for display in promt if non-zero

also future-proofs for other benefits / DRYness. no need for another eval invocation.

* fix generated manpage
2026-01-20 14:11:45 +08:00
John Bachir b9bd309a87
Improve git-repl prompt (#1224)
* repl config ideas

* documentation

* Update bin/git-repl

Co-authored-by: Edwin Kofler <edwin@kofler.dev>

* separator

* man page and web docs

* always use dir for project name

---------

Co-authored-by: Edwin Kofler <edwin@kofler.dev>
2026-01-19 16:15:42 -08:00
johnpyp 6f4cf0c1bb
feat: delete-branch multiple unique branch names completions (#1221) 2025-12-18 12:40:24 -08:00
dependabot[bot] f5c48e4842
chore(deps): bump actions/checkout from 5 to 6 (#1219)
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-24 10:42:06 +08:00
Hugo Ruiz-Mireles daf9d4148e
Made Git Magic use --force-with-lease (#1218)
This change simply overwrites the usage of `-f` with
`--force-with-lease` in git-magic because `--force-with-lease` is a
safer alternative.
2025-10-22 11:49:27 +08:00
dependabot[bot] eb34655aea
chore(deps): bump actions/stale from 9 to 10 (#1214)
Bumps [actions/stale](https://github.com/actions/stale) from 9 to 10.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v9...v10)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-version: '10'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-08 10:29:50 +08:00
dependabot[bot] 1f1320f4d6
chore(deps): bump actions/setup-go from 5 to 6 (#1215)
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5 to 6.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-08 10:29:28 +08:00
dependabot[bot] 4d05955bc5
chore(deps): bump actions/setup-python from 5 to 6 (#1216)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5 to 6.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-08 10:28:51 +08:00
Daniele Paolella b57eb8b92a
Fix minor typo in git rename-branch man page (#1211)
* docs: fix symbols in `git rename-branch` man page

* Format doc page after others and rebuild artifacts
2025-09-04 10:51:48 +08:00
Daniele Paolella cf6d40d446
Improvements to Bash completion (#1210)
* Sort Bash completion functions

* feat: add Bash completion for `git rename-branch`

* feat: add Bash completion for `git rename-remote`

* feat: add Bash completion for `git rename-tag`

* fix: use default completion for `git rename-file`

* Refactor rename completion functions common logic
2025-08-29 18:29:31 +08:00
Edwin Kofler 14586c7da0
Fix use of git-whatchanged to git-log (#1212) 2025-08-29 18:27:55 +08:00
dependabot[bot] 5c9a7a2533
chore(deps): bump actions/checkout from 4 to 5 (#1209)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-18 11:15:38 +08:00
罗泽轩 215382b12d
Bump version to 7.5.0-dev (#1207)
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2025-06-23 11:08:27 +08:00
罗泽轩 13cbdfc51e
Version 7.4.0 (#1206)
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2025-06-20 11:12:58 +08:00
Edwin Kofler 3ddc315a76
Format comparisons, functions, and redirections to be consistent (#1201)
* Format comparisons and functions to be consistent

* Add `checkstyle.py` script and add check to CI

* Fix Ruff lints
2025-06-06 11:10:50 +08:00
Andrew Sullivan Cant c63b46a33b
add git-wip and git-unwip (#669)
* Upgrade codespell to v2.4.0

It is a lastet verison, and is needed so that I can use the inline
ignore support in a future commit.

After updating tests/pyproject.toml I ran the following commands:
```
cd tests
poetry lock --no-update
poetry install
```

I also fixed a spelling error in man/git-summary.md, which was not
caught by the old version of codespell. After updating the file I also
updated the related files by running the following commands:

```
cd man
make -C .. man/git-summary.{1,html}
```

* add git-wip and git-unwip

Updated/re-built the documentation with:
```
cd man
make -C .. man/git-unwip.{1,html}
make -C .. man/git-wip.{1,html}
make -C .. man/git-extras.{1,html}
```
2025-05-14 17:05:41 +08:00
dependabot[bot] d4cd272556
Merge pull request #1203 from tj/dependabot/github_actions/bats-core/bats-action-3.0.1 2025-03-31 05:00:48 +00:00
dependabot[bot] 783812b627
chore(deps): bump bats-core/bats-action from 3.0.0 to 3.0.1
Bumps [bats-core/bats-action](https://github.com/bats-core/bats-action) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/bats-core/bats-action/releases)
- [Commits](https://github.com/bats-core/bats-action/compare/3.0.0...3.0.1)

---
updated-dependencies:
- dependency-name: bats-core/bats-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-31 00:23:42 +00:00
Edwin Kofler c49ca70814
Mostly finish pytest to Bats conversion (#1200)
* Mostly finish pytest to Bats conversion

* Add Bats version note to testing docs

* Move Bats CI check to separate job
2025-03-26 11:19:30 +08:00
Edwin Kofler 18ecffef5e
Implement half of tests in Bats (#1187)
Some checks failed
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / test (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
* Initial scaffold

* Finish first half of Bats tests

* Add Bats to CI

* Fix CI

* Fix CI

* Fix configuration to set git name and email

* Fix `GIT_CONFIG_{KEY,VALUE}` indexing

* Fix Git config override precedence

* Remove unused and untested function
2025-03-12 18:15:37 +08:00
Edwin Kofler aadf5f874b
Add stale bot for old PRs (#1186)
* Add stale bot for old PRs

* Update message

* Update .github/workflows/stale.yaml

Co-authored-by: 罗泽轩 <spacewanderlzx@gmail.com>

* Fix stale workflow

* Update .github/workflows/stale.yaml

Co-authored-by: 罗泽轩 <spacewanderlzx@gmail.com>

---------

Co-authored-by: 罗泽轩 <spacewanderlzx@gmail.com>
2025-03-12 18:14:53 +08:00
Pierre Ayoub 18d1017325
feat(git-bulk): add new option to not follow hidden directories (#1195)
Some checks failed
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / test (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
* feat(git-bulk): add --no-follow-hidden flag

* docs(git-bulk): add --no-follow-hidden description

* docs(man): make ronn

* docs(git-bulk): put --no-follow-hidden at right place in usage()

* refactor(git-bulk): logic optimization

Remove unnecessary subshell

Co-authored-by: Edwin Kofler <edwin@kofler.dev>

* fix(git-bulk): bad test operator

With the Bash' regexp matching operator `=~`, we need to use the Bash
conditional expression evaluation command `[[ ]]`.

* docs(completion.zsh): add --no-follow-hidden and --no-follow-symlink

---------

Co-authored-by: Pierre Ayoub <pierre.ayoub@protonmail.com>
Co-authored-by: Edwin Kofler <edwin@kofler.dev>
2025-03-05 10:39:41 +08:00
Pierre Ayoub a841845d9a
Feat: allow git-summary showing full path of repository (#1193)
Some checks failed
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / test (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
* feat(git-summary): add --full-path option

* docs(git-summary): add doc for --full-path option

* docs(man): make using ronn

* docs(git-extras-completion.zsh): add --full-path option of git-summary
2025-02-27 14:25:55 +08:00
Pierre Ayoub 8eed5f49ad
feat(git-bulk): add new option to no follow symlinks (#1194)
* feat(git-bulk): add --no-follow-symlinks flag

* docs(git-bulk): add --no-follow-symlinks description

* docs(man): make ronn

* docs(git-bulk): put --no-follow-symlinks at right place in usage()

* fix(git-bulk): use readarray for find command

1. Use `readarray` such that we can handle paths with spaces
2. Remove the unnecessary `eval`
2025-02-27 14:18:16 +08:00
Pierre Ayoub 64687599ae
docs(git-bulk): Add zsh completion (#1190)
* docs(git-bulk): Add zsh completion

* docs(git-bulk): Harmonize help strings

* docs(git-bulk): simplify previous bad logic

The previous logic was not allowing to use multiple options (which is
often the case). This was bad because this is my first time with zsh
automcompletion. Without it, the user can use any flag combination --
but at least, he has the freedom.
2025-02-26 12:34:04 +08:00
Pierre Ayoub 8ce63003c0
fix(git-bulk): fix workspace selection when cd fails (#1197)
* fix(git-bulk): fix workspace selection when cd fails

`cd` may fails for multiple reasons:
- mistake when editing `.gitconfig` manually
- previously existing workspace that have been removed
- ...

Currently, if `cd` fails, the `BulkOp` continue its execution ... in the
workspace defined in a higher directory that where the user, despite the
user specified a specific workspace (`-w`).

The user should be noticed of a failed `cd` (this is really not expected
for a valid configuration) and the operations should stop to not execute
something unexpected.

* fix(git-bulk): replace weak eval for better variable substitution

Get rid of poor `eval` syntax because they are vulnerable to command
injection, which may have unexpected side effects.

However, they enabled a useful feature: using environment variable
(*e.g.*, defined in a `.bashrc`) inside the `.gitconfig` to use dynamic
paths as  `bulk` workspaces.

As such, I keep this feature possible by using the Bash's ${!VAR}
syntax, which allows to get the value of one variable using the name of
a another variable. However, arbitrary command injection is not possible
anymore.

* fix(git-bulk): missing check about empty environnement variable

* style(git-bulk): typo

* docs(Commands.md): git-bulk env var feature

* docs(man/git-bulk): git-bulk env var feature

* docs(man/git-bulk): mention .gitconfig for config storage

* style(man/git-bulk): typo

* docs(man/git-bulk): run make/ronn for .1 and .html
2025-02-26 12:33:16 +08:00
Pierre Ayoub 1a9b0c2ab4
fix(git-bulk): quiet find errors by default (#1196)
Some checks failed
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / test (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
2025-02-20 15:47:27 +08:00
Pierre Ayoub 82cc37d0f5
fix(git-bulk): fix a bad integer expression (#1198)
Fix a logic error inside the `allowedargcount()` function. This function
may be called with one or two arguments. However, no default values are
assigned to `$1` and `$2` that are used inside a numerical comparison.
Therefore, when using a bad number of arguments for the following lines:

```
listall|purge) allowedargcount 1;;
addcurrent|removeworkspace) allowedargcount 2;;
```

Then, we would get the error `[: : integer expression expected`. To fix
this, we assign the 0 default value to `$1` and `$2`, such that we
trigger the error message destined to the user without any integer error
when there is a bad number of argument and that the function is called
with only 1 argument instead of 2.
2025-02-20 15:41:42 +08:00
dependabot[bot] df53711fc7
chore(deps): bump astral-sh/ruff-action from 2 to 3 (#1189)
Some checks failed
ci / test (push) Has been cancelled
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
Bumps [astral-sh/ruff-action](https://github.com/astral-sh/ruff-action) from 2 to 3.
- [Release notes](https://github.com/astral-sh/ruff-action/releases)
- [Commits](https://github.com/astral-sh/ruff-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: astral-sh/ruff-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-29 18:13:50 -08:00
oikarinen e691826b4b
Fix all ShellCheck errors and add to CI (#1179)
Some checks failed
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / test (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
2024-12-20 23:16:39 -08:00
dependabot[bot] fdaca2cd26
chore(deps): bump astral-sh/ruff-action from 1 to 2 (#1188)
Some checks failed
ci / typo (push) Has been cancelled
ci / test (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
ci / lint (push) Has been cancelled
Bumps [astral-sh/ruff-action](https://github.com/astral-sh/ruff-action) from 1 to 2.
- [Release notes](https://github.com/astral-sh/ruff-action/releases)
- [Commits](https://github.com/astral-sh/ruff-action/compare/v1...v2)

---
updated-dependencies:
- dependency-name: astral-sh/ruff-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-02 10:06:50 +08:00
oikarinen 3db275cbe2
fix(ci): use poetry (#1183)
Some checks failed
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / test (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
For managing the python dependencies, running the unit tests and
spellchecker. This makes it easier for everyone to have same environment
as CI. Also includes few cosmetic edits for style for the ci.yml
2024-11-29 10:39:42 +08:00
Edwin Kofler 1345c5977d
Delete etc/test.fish (#1185) 2024-11-29 10:39:09 +08:00
oikarinen 2f4b57d52b
feat: add git-continue (#1176)
Some checks are pending
ci / lint (push) Waiting to run
ci / typo (push) Waiting to run
ci / test (push) Waiting to run
ci / build (macos-latest) (push) Waiting to run
ci / build (ubuntu-latest) (push) Waiting to run
* feat: add git-continue

Also refactor `git-abort` to parse action from the called file name.

There's a promise for this in #865 but that was a long time ago.

* fix: add git-continue

address review comments, fix the script, remove unnecessary testpath
import.
2024-11-28 16:50:29 +08:00
oikarinen c23da8ae9c
feat: add ruff linter with ci check (#1182)
Some checks are pending
ci / lint (push) Waiting to run
ci / typo (push) Waiting to run
ci / test (push) Waiting to run
ci / build (macos-latest) (push) Waiting to run
ci / build (ubuntu-latest) (push) Waiting to run
* feat: add ruff linter with ci check

Liniting the python files in tests directory would reduce whitespace etc
change and enforce basic coding standard for those. Kind of
opportunistic PR as there might be other opinions about how to deal with
this.

* fix: format with ruff
2024-11-28 10:30:14 +08:00
oikarinen f1f50ac5ba
fix(ci): missing dollar sign (#1184)
Some checks are pending
ci / lint (push) Waiting to run
ci / typo (push) Waiting to run
ci / test (push) Waiting to run
ci / build (macos-latest) (push) Waiting to run
ci / build (ubuntu-latest) (push) Waiting to run
Let's get the ci fixed!
2024-11-27 08:40:33 -08:00
oikarinen 0989b773de
fix(github-actions): changed files output for editorcondig-checker (#1180)
Some checks failed
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / test (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
* fix(github-actions): changed files output for editorcondig-checker

Seems that ci.yml includes a dead dependency action just to get list of
changed files for the PR / push. This seems weird as the repo is all
about git. Propose removing this extra dep with straightforward
implemenation. Also: github runners do have `jq` preinstalled.

* feat(ci): print changed files to log in lint job
2024-11-26 11:53:50 +08:00
罗泽轩 65203312c1
Revert "feat: add ruff linter with ci check (#1178)" (#1181)
Some checks are pending
ci / lint (push) Waiting to run
ci / typo (push) Waiting to run
ci / test (push) Waiting to run
ci / build (macos-latest) (push) Waiting to run
ci / build (ubuntu-latest) (push) Waiting to run
This reverts commit a2c424aada.
2024-11-25 14:32:54 +08:00
oikarinen a2c424aada
feat: add ruff linter with ci check (#1178)
Some checks are pending
ci / lint (push) Waiting to run
ci / typo (push) Waiting to run
ci / test (push) Waiting to run
ci / build (macos-latest) (push) Waiting to run
ci / build (ubuntu-latest) (push) Waiting to run
* feat: add ruff linter with ci check

Liniting the python files in tests directory would reduce whitespace etc
change and enforce basic coding standard for those. Kind of
opportunistic PR as there might be other opinions about how to deal with
this.

* fix: format with ruff
2024-11-25 10:14:37 +08:00
Guilhem Saurel d291b2775c
Support GITHUB_TOKEN var for git-fork and git-pull-request (#1177)
Some checks failed
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / test (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
Co-authored-by: 罗泽轩 <4161644+spacewander@users.noreply.github.com>
2024-11-16 10:33:26 -08:00
罗泽轩 fb0bc6950b
Bump version to 7.4.0-dev (#1175)
Some checks failed
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / test (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2024-10-22 10:07:46 +08:00
罗泽轩 21a086c009
Version 7.3.0 (#1174)
Some checks failed
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / test (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2024-10-20 18:16:23 +08:00
Jared Baur 8eb1d72f07
Fix stripping trailing forward slash for git-get (#1172)
Some checks failed
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / test (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
2024-10-18 10:22:05 +08:00
Mattias Andersson 233686d2a2
Change git-cp to use cleaner branch approach (#1169)
Some checks failed
ci / test (push) Has been cancelled
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
* Change git-cp to use cleaner branch approach, per https://stackoverflow.com/a/46484848/32841 and https://devblogs.microsoft.com/oldnewthing/20190919-00/?p=102904

* Name the temporary branch to better fit in with git-extras

* Again, git-extras naming is "copy", not "split"

* Make the commit messages more clear
2024-10-08 11:40:43 +08:00
Edwin Kofler 5c3fb1b062
Improve warning for git clear (#1168)
Some checks failed
ci / test (push) Has been cancelled
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
2024-09-30 10:07:52 +08:00
wyattscarpenter 5ca9360109
Enhance git-repl (#1160)
Some checks failed
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / test (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
2024-09-22 20:22:58 -07:00
wyattscarpenter 16d1445271
Update some documentation that was out of sync (#1164)
Some checks are pending
ci / build (ubuntu-latest) (push) Waiting to run
ci / typo (push) Waiting to run
ci / test (push) Waiting to run
ci / lint (push) Waiting to run
ci / build (macos-latest) (push) Waiting to run
* make instructions easier to copy-paste

* update some documentation that was out of sync
2024-09-22 14:11:31 +08:00
wyattscarpenter 4d2d393142
Use filetimes in check_integrity (#1162)
Some checks failed
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / test (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
* check the file times in check_integrity

* make no-arguments to check_integrity check all commands, and also make check_integrity run git-utimes first

this has the downside that the script now takes a little longer. But the upside that it guarantees more correctness.

* update git-extras

using the incredible power of the new script, I have detected this was out of date, out of sync, etc
2024-09-19 11:27:11 +08:00
wyattscarpenter ffee88a246
Update git-alias.md: add brs to prevent incorrect line behavior (#1161)
* Update git-alias.md: add brs to prevent incorrect line behavior

currently these all appear on one line, in the rendered markdown viewer and also in the man page. That isn't what's wanted. What's wanted is for each to be on its own line, which this change implements, using the strategy I found in git-bulk.

* run make on git-alias
2024-09-19 11:19:48 +08:00
wyattscarpenter da03b7b133
Update git-bulk.md: use correct stylization in synopsis (#1163)
* Update git-bulk.md: use correct stylization in synopsis

* update derived documents for git-bulk
2024-09-19 11:17:00 +08:00
wyattscarpenter f0671e2733
Update git-repl.md: typo: "let's" for "lets" (#1158)
Some checks failed
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / test (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
2024-09-16 12:19:03 -07:00
Revisor 2c161aae02
Update instructions for the OpenSUSE installation (#1157)
Some checks failed
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / test (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
2024-09-04 13:59:35 +08:00
Wiktor Żurawik f0b9e18e54
Add pathspec support in git-missing (#1156)
Some checks failed
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / test (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
* feat: Add pathspec support in git-missing

Allow to specify a path to limit the commit difference list. This
improvement allows users to focus on changes in specific directories or
files when comparing branches for missing commits.

* refactor: Improve pathspec handling in git-missing

- Change pathspec from string to array to support multiple pathspecs
- Remove unnecessary 'shift' command in argument processing loop
- Simplify git log command execution by using a single codepath

* chore: Update git-missing docs

* chore: Fix a typo in git-missing docs
2024-08-26 10:38:15 +08:00
CodeByZach c32869de37
feat: add rename-file command (#1149)
Some checks failed
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / test (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
2024-08-02 01:19:35 -07:00
Matt Headley e1a4e7195d
Update Commands.md (#1148)
Some checks failed
ci / lint (push) Has been cancelled
ci / typo (push) Has been cancelled
ci / test (push) Has been cancelled
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-latest) (push) Has been cancelled
2024-07-05 10:15:22 +08:00
Wen Sun b766a655ce
fix: git-summary commit count (#1147)
* fix: git-summary commit count

* fixup! fix: git-summary commit count
2024-06-18 11:13:07 +08:00
Raphael Boidol e34dea9b7a
tests: update dependencies (#1142) 2024-05-03 14:52:28 +08:00
dependabot[bot] 3bac05e690
chore(deps): bump masesgroup/retrieve-changed-files from 2 to 3 (#1144)
Bumps [masesgroup/retrieve-changed-files](https://github.com/masesgroup/retrieve-changed-files) from 2 to 3.
- [Release notes](https://github.com/masesgroup/retrieve-changed-files/releases)
- [Commits](https://github.com/masesgroup/retrieve-changed-files/compare/v2...v3)

---
updated-dependencies:
- dependency-name: masesgroup/retrieve-changed-files
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-29 09:59:50 +08:00
dependabot[bot] a7ad306a6b
chore(deps): bump actions/setup-go from 4 to 5 (#1143)
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4 to 5.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-29 09:59:43 +08:00
Raphael Boidol dcb8bd6c54
ci: add dependabot update for GitHub actions (#1141) 2024-04-28 10:06:37 +08:00
Raphael Boidol a1bf09e8e0
ci: update actions (#1140) 2024-04-27 18:04:27 +08:00
罗泽轩 615ea971cb
Bump version to 7.3.0-dev (#1139)
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2024-04-25 10:53:37 +08:00
罗泽轩 e692b9619a
Version 7.2.0 (#1138)
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2024-04-23 19:59:09 +08:00
Leroy a17d2fb15d
refactor: test utils and simplify the case code (#1136)
* doc(tests/README.md): explain the unit test process

* test(TempRepository): support to change origin and get filename

* refactor: simplify the case code

    * test_git_browse_ci.py
    * test_git_browse.py

* fix: rename `test_authors.py` to `test_git_authors.py`

* fix: typo

* fix: log the GitCommandError
2024-02-29 11:11:00 +08:00
Edwin Kofler 52897f73b9
Add --proceed flag to git-delete-squashed-branches (#1134) (#1135)
Co-authored-by: Norbert Kiesel <nk@iname.com>
2024-02-20 10:47:36 +08:00
Leroy 5f19424a50
test(browse-ci): add unit tests (#1130) 2024-01-30 10:43:32 +08:00
Leroy b54d8c7c50
test(git-browse): add unit tests (#1127)
* chore: add the dependency testpath@0.6.0

* test(git-browse): add unit tests

* fix: update origin name to `tj/git-extras`
2024-01-05 14:31:37 +08:00
Josh McKinney 9049967232
feat: add reverse option to git-brv (#1123)
* feat: add reverse option to git-brv

When there are a large amount of branches it is often useful to see the
most recent branches last as they end up closer to the prompt. This adds
a new --reverse / -r option and an environment variable to set the
default behavior (GIT_BRV_REVERSE).

* git-brv: change to git option instead of environment variable and fix typo

* wrap git option in backticks for git-brv and fix git-feature title

* update git-feature docs

* fix missing breaks in git-feature.md
2023-12-16 12:05:52 +08:00
Edwin Kofler cdbcef3227
Merge pull request #1124 from rasa/patch-3
fix(utimes): change /dev/stdin to -
2023-12-14 19:36:32 -08:00
Ross Smith II a4b637346d
fix(utimes): change /dev/stdin to -
As not all environments have /dev/stdin. See https://github.com/ish-app/ish/issues/944
2023-12-13 07:51:50 -08:00
Ross Smith II 1843afb38a
fix(utimes): Support filenames with backspaces, etc. (#1122) 2023-12-12 14:50:21 +08:00
Leroy 28b48c7432
chore: add poetry to handle the tests of the git extras (#1121)
* chore: add poetry to handle the tests of the git extras

* chore(ci): upgrade the deps version

* chore(CONTRIBUTING): remove the test description
2023-12-01 14:25:14 +08:00
Ross Smith II 2c2bd07693
Fix typo in ci.yml (#1120) 2023-11-25 14:02:35 +08:00
Ross Smith II e39b1ab6a6
Fix: harden utimes, use single quotes (#1109)
* Fix: harden utimes, use single quotes

* Remove passing --posix to bash

* Remove double-quotes and backslashes

* Fix: patch git-utimes (fixes #1118)

Fixes #1118

* Fix formatting issue in git-utimes

Per https://github.com/tj/git-extras/pull/1109#discussion_r1399965099
2023-11-23 11:39:56 +08:00
Ross Smith II 058cb0763e
Fix: patch git-utimes (fixes #1118) (#1119)
I don’t have a Mac/BSD system to test, but this should fix #1118
2023-11-23 11:38:33 +08:00
罗泽轩 3d964687fc
add pull request manner (#1113)
* add pull request manner

Signed-off-by: spacewander <spacewanderlzx@gmail.com>

* Update .github/PULL_REQUEST_TEMPLATE.md

Thanks for @hyperupcall

Co-authored-by: Edwin Kofler <edwin@kofler.dev>

---------

Signed-off-by: spacewander <spacewanderlzx@gmail.com>
Co-authored-by: Edwin Kofler <edwin@kofler.dev>
2023-11-21 10:39:44 +08:00
Edwin Kofler ca18c6e552
maintenance: Add my name as maintainer in AUTHORS (#1117) 2023-11-21 10:32:52 +08:00
Leroy cf9fe2d23f
test(git-authors): add unit test (#1098) 2023-11-18 10:20:19 +08:00
Edwin Kofler c13ab52138
Add more comprensive dependencies (#1111) 2023-11-18 10:19:10 +08:00
René 58c5b50514
fix: git-standup find error (tj#1106) (#1110) 2023-11-14 12:05:28 +08:00
Edwin Kofler 5020890c34
Improve defaults for testing suite (#1104) 2023-11-11 12:55:46 +08:00
Ross Smith II 4d8060e8cb
feat: Speed up utimes (#1108) 2023-11-11 12:52:04 +08:00
Edwin Kofler 7a65311b1c
Overhaul CONTRIBUTING document (#1103) 2023-11-11 12:50:50 +08:00
罗泽轩 186bbdcb87
Bump version to 7.2.0-dev (#1099)
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2023-11-02 12:00:12 +08:00
罗泽轩 bfef91f30a
Version 7.1.0 (#1097) 2023-10-29 18:52:56 +08:00
罗泽轩 78c5ca28a0
git-cp: don't stop execution when merge.ff is not set (#1096)
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2023-10-26 12:28:19 +08:00
Wei Wu 90221f2149
Allow git cp to create destination folder automatically (#1091)
* Allow `git cp` to create destination folder automatically

* Replace subshell command with builtin operation to infer DESTINATION_DIR

* Remove destination folder existence check and only create it when the path contains slash(s)
2023-10-25 12:03:36 +08:00
Edwin Kofler 263dcb4a79
fix: Use -iname and expressions instead of -iregex (#1094) 2023-10-24 21:52:59 +08:00
罗泽轩 cc1c0e1a38
change installation source from master to main (#1092)
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2023-10-23 12:13:40 +08:00
Leroy 04bf403861
test(git-archive-file): add unit test (#1084) 2023-10-17 13:54:09 +08:00
Edwin Kofler 5fe4226865
ci: Use Go v1.20 for running editorconfig-checker (#1086) 2023-10-15 10:19:41 +08:00
Leroy bddb987383
test(git-alias): add its unit test (#1077) 2023-09-27 10:21:35 +08:00
Edwin Kofler df1997c0dc
makefile: Allow bypassing conflict check (#1080) 2023-09-26 11:35:24 +08:00
Edwin Kofler 954ba1fb7c
fix: Restore zsh completions to working completion (#1079) 2023-09-23 13:38:15 +08:00
Gerrit-K e4152db482
fix: add missing quote in git-extras-completion.zsh (#1078)
Broken in #1074
2023-09-22 19:31:09 +08:00
Edwin Kofler dee7c7f1d0
feat: Implement completion for git coauthor (#1074) 2023-09-22 11:58:01 +08:00
Edwin Kofler e793f8979b
fix: Move improvements via ShellCheck (#1075) 2023-09-22 11:57:48 +08:00
Leroy d2dde69d14
feat(auto-test): CI with pytest (#1066)
* feat(ci): add pull request action and pytest.ini

* test(git-abort): add its unit test
2023-09-19 11:11:43 +08:00
Austin Ziegler 49650eda62
git-feature: add configurable branch separator (#1072)
* git-feature: add configurable branch separator

Closes #1069

This allows the use of a separator other than `/` for feature or other
alias branches. While a command-line option has been provided (`-s` or
`--separator`), this will most often be used via
`git-extras.feature.separator`.

* Significant update to bin/git-feature

- Changed option parsing so that `--alias` requires an argument and will
  fail with an error unless provided. Applied the same logic to
  `--separator`.

- Changed `finish` parsing to capture it as a variable flag during
  argument parsing.

  This could be extended so that if `finish` is already true, a second
  `finish` results in the word being added to the argument list.

  ```console
  $ git feature -- finish remote
  $ git feature finish finish remote
  ```

  This has not been done because it is a bit of an inconsistent handling
  for documentation purposes.

- Add handling of `--` to permit options or `finish` to be made part of
  the feature branch name.

- Since `finish` is now a variable flag, simplify the name-building
  logic to always use `concatargs "${argv[@]}"`. This means that
  `git feature finish ...` and `git feature ...` behave the same in
  terms of feature branch name building.

- Basically rewrote the man page to include better descriptions of the
  options as well as adding a GIT CONFIG section and additional EXAMPLES
  for the new features/behaviour.
2023-09-19 11:10:59 +08:00
Dan Goodliffe 76cd9bdf45
git-psykorebase: determine branch names with bash pattern substitution (#1073)
Co-authored-by: Dan Goodliffe <dan.goodliffe@octal.co.uk>
2023-09-17 22:07:32 +08:00
罗泽轩 f95e339c03
git-cp: continue to merge when merge.ff is only (#1070)
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2023-09-13 13:02:06 +08:00
Austin Ziegler db71be578e
git archive-file: change base ARCHIVE_NAME (#1071)
Closes #1067

This makes the base ARCHIVE_NAME for `git-archive-file` to be the name
of the repo root directory instead of the name of the current directory.
2023-09-13 13:01:37 +08:00
Edwin Kofler cb29c62c65
readme: Add secondary location of screencast (#1065)
And, fix other typos.
2023-08-29 19:37:54 +08:00
Edwin Kofler 47e940272a
fix: Improve Bash hygiene (#1056)
* fix: Improve Bash hygiene

* Update quoting to account for new bugs

* quotes

* fix: Remove extra shellcheck comment
2023-08-18 16:15:40 +08:00
Edwin Kofler 8af43892f6
feat: Implement git-get command (#1045)
* feat: Add `git-get` command

* Update Commands.md

Co-authored-by: 罗泽轩 <spacewanderlzx@gmail.com>

* fix: Use Git config to store value

* improve `git-get` description

* fix: Add `--global` to git invocation

* Enable passing options to `git clone`

* fix: Ordering of checks

---------

Co-authored-by: 罗泽轩 <spacewanderlzx@gmail.com>
2023-08-12 13:49:33 +08:00
SchleimKeim 34609bd800
Corrected grammar in bin/git-cp (#1061)
Corrected grammar in bin/git-cp:41
2023-08-10 15:35:01 +08:00
Edwin Kofler 0b5d2cce55
Improve git-ignore command (#1047)
* Improve `git-ignore` command

* fix: Improve warnings/errors and modify `not_need_git_repo`
2023-07-13 14:29:39 +08:00
Jobin Kurian d7fb4495f1
I have made two improvements to the git-bulk: (#1054)
* I have made two improvements to the git-bulk:
1. Previously, if the "repository.txt" file did not end with a blank line, only three out of four repositories were cloned. This limitation has been fixed.
2. Now, there is support for cloning repositories into custom folder names when using the "repository.txt" file.

* Corrected the code indentation.

* removed the extra condition to check is the line was empty or not.

* Updated the comment for the new changes in the code.

---------

Co-authored-by: Jobin Kurian <jobin.kurian@netcorecloud.com>
2023-07-07 11:08:23 +08:00
Hemanth HM 5e543cb620
Merge pull request #1052 from spacewander/gsm
Add typo checker
2023-06-19 08:24:24 -07:00
kang 3a258cbaad
Type properly __gitex_command_successful calls and capitalizate github to GitHub (#1049)
* Type properly `__gitex_command_successful` calls

* Capitalize github to GitHub
2023-06-19 22:05:30 +08:00
spacewander ba9e6f0c5c Add typo checker 2023-06-19 21:51:53 +08:00
Nate Eagleson 5d7ed18c50
Fix comment typo in git-authors (#1050) 2023-05-29 10:25:08 +08:00
Edwin Kofler 2d221c1b67
tweak: Fix typos (#1046) 2023-05-18 10:19:24 +08:00
Igor Ostapenko f5bcbe5b0d
Makefile: init SYSCONFDIR before using it (#1044) 2023-05-08 09:57:55 +08:00
Igor Ostapenko 6d73f74f83
Makefile: tune MANPREFIX configuration for FreeBSD (#1043)
We could think of the following use cases:

1. User installs git-extras from official port/pkg. man/man* structure
is quite common among different systems, but location of man/ itself can
be different. FreeBSD Ports framework setups MANPREFIX to PREFIX by
default, i.e. it's /usr/local. The idea is that software may provide
different man/man* sections, with final path being /usr/local/man/man*.
In contrast, git-extras' Makefile process simplifies the things due to
it works with section 1 only, and expects MANPREFIX to be set down to
man/man1 path. For this reason, installation via FreeBSD Ports requires
unconditional man path configuration like this:

    ifeq ($(OS), FreeBSD)
        MANPREFIX = "$(PREFIX)/man/man1"

Otherwise, the path will be incorrect. And this is how official FreeBSD
port of git-extras has been fixing this difference for many years.

2. End user installs git-extras manually. There are two sub-cases:

  2.a. User explicitly defines custom MANPREFIX. Okay, it's user's
  decision -- nothing to do here, just follow as is.

  2.b. User does not define custom paths, i.e. it's expected to be
  installed according to FreeBSD defaults. And default values in
  git-extras' Makefile forms the expected correct path.

This change supports all the cases above, with the goal to avoid wrong
man path for the most of the situations. As long as official git-extras
make process tries to support FreeBSD, this change allows to omit extra
patching for FreeBSD Ports framework.
2023-05-05 09:46:38 +08:00
Igor Ostapenko bbf90c4623
Makefile: set bash COMPL_DIR to FreeBSD expected defaults (#1042)
See official conventions: https://docs.freebsd.org/en/books/porters-handbook/special/#shell-completion
2023-05-04 11:19:25 +08:00
罗泽轩 2fca5edb7d
Bump version to 7.1.0-dev (#1041) 2023-04-26 10:29:51 +08:00
罗泽轩 d7f0fcc546
Version 7.0.0 (#1040) 2023-04-24 22:03:26 +08:00
罗泽轩 df825715ba
Need bash 4.0+ (#1038) 2023-04-19 16:57:04 +08:00
hemanth.hm 2d5b12c01f
Merge pull request #1036 from spacewander/del
git-delete-tag: should not be quoted
2023-03-06 18:02:52 -08:00
spacewander 753555744b git-delete-tag: should not be quoted
Otherwise the whole result will be considered one tag/ref.
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2023-03-07 09:11:37 +08:00
Günther Grill d5eaa1895b
Add the current branch git summary (#1034)
Co-authored-by: guenthgr <guenther.grill@frauscher.com>
2023-02-27 11:26:53 +08:00
Edwin Kofler b372bab52a
chore: Improve Bash variously (#1032) 2023-02-21 10:03:56 +08:00
Günther Grill a008308267
Change the oneline option to a tebular version in the git summary (#1031)
Co-authored-by: guenthgr <guenther.grill@frauscher.com>
2023-02-12 20:14:16 +08:00
Edwin Kofler 5d0fe32617
chore: Remove X-style equality comparisons (#1028) 2023-02-03 09:41:52 +08:00
Edwin Kofler 75d0dbff6d
chore: Various Bash improvements (#1029) 2023-02-03 09:41:36 +08:00
hemanth.hm 9c3343d1ee
Merge pull request #1030 from hyperupcall/fix-reset-env
fix: No longer pollute env with `GREP_OPTIONS`
2023-02-01 16:29:54 -08:00
Edwin Kofler 82daeb7c94
fix: No longer pollute env with GREP_OPTIONS 2023-01-30 21:00:39 -08:00
罗泽轩 73fbf8e08d
tweak editor config (#1027) 2023-01-28 17:15:20 +08:00
罗泽轩 36e6de10c8
revert the completion dir change on MacOS (#1026)
Fix https://github.com/tj/git-extras/issues/1018
2023-01-27 19:38:56 +08:00
Wei Lee e1138b8190
Update gitignore.io urls to Toptal urls (#1025) 2023-01-27 17:49:38 +08:00
Edwin Kofler 589ef33e35
Add EditorConfig file (#1022) 2023-01-27 17:47:06 +08:00
Günther Grill e4e7310c49
Make the bulk output slimmer (#1020)
Co-authored-by: guenthgr <guenther.grill@frauscher.com>
2023-01-20 18:18:10 +08:00
Edwin Kofler 4611b24320
chore: Fix more Bash inconsistencies (#1021) 2023-01-20 18:17:49 +08:00
Günther Grill 04eb5c04e6
Repo status overview (#1017)
Co-authored-by: guenthgr <guenther.grill@frauscher.com>
2023-01-13 13:43:03 +08:00
Piotr Górski e29dcbb023
Replace egrep with grep -E (#1019) 2023-01-12 09:51:22 +08:00
Edwin Kofler d34fa527a0
chore: More Bash improvements and removing deprecations (#1016) 2023-01-10 08:59:43 +08:00
Edwin Kofler 35100b4e6f
chore: Improve quoting and builtin usage (#1015) 2023-01-04 08:58:31 +08:00
Günther Grill cd348dad21
Add summary fields (#1013)
Co-authored-by: guenthgr <guenther.grill@frauscher.com>
2023-01-04 08:58:16 +08:00
Günther Grill aea25d2d4b
Fix quiet mode of the bulk command (#1014)
Co-authored-by: guenthgr <guenther.grill@frauscher.com>
2022-12-28 09:11:53 +08:00
Kurban Mallachiev 4fff03f429
git-summary: remove stray \ in grep call (#1010) 2022-12-19 18:02:29 +08:00
Günther Grill 7c4152ce83
Allow to run git-extras within git-bulk (#1008)
Co-authored-by: guenthgr <guenther.grill@frauscher.com>
Fix https://github.com/tj/git-extras/issues/1007
2022-12-07 13:58:18 +08:00
Áron Hoffmann 960ec8d2fd
Make git-summary accept multiple paths for the --lines argument (#1005) 2022-11-22 13:40:37 +08:00
罗泽轩 1426002037
Makefile: ensure bash is used instead of /bin/sh (#1004) 2022-11-12 12:19:35 +08:00
zhiyanfoo 193a6dd2a8
fix base branch in the pull-request command (#1003) 2022-11-12 12:10:57 +08:00
Joshua Li 2d1aa6daea
Update docs for git abort change (#1000) 2022-10-17 15:45:52 +08:00
罗泽轩 71af8cec42
Bump version to 6.6.0-dev (#997) 2022-10-10 10:32:37 +08:00
spacewander 3ac3c54b06 Version 6.5.0
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2022-10-06 20:33:44 +08:00
罗泽轩 584e0283f5
git root: show '.' when using with -r in the root dir (#995) 2022-10-06 13:56:07 +08:00
罗泽轩 62aa91f221
git standup: work as expected when no configured (#996) 2022-10-06 13:55:45 +08:00
Sascha Andres 25b5d734c7
rephrase question depending on switch (#984) 2022-10-06 13:43:35 +08:00
Joshua Li 06aa5dbb1f
Include revert conflicts in git abort (#992) 2022-10-06 13:26:20 +08:00
Lone 8058b1718f
fix(git-effort):fork: retry: Resource temporarily unavailable #979 (#990) 2022-09-25 20:04:51 +08:00
timfeirg 956781ac1b
git-sync --force will sync without interaction (#989) 2022-08-24 14:28:05 +08:00
罗泽轩 3b9ea70e09
Merge pull request #988 from vanpipy/feature/fix-git-cp-did-not-keep-history
fix(git-cp): keep the history of the files
2022-08-05 18:17:54 +08:00
vanpipy 6e6f59b264 fix(git-cp): keep the history of the files 2022-08-01 09:12:47 +08:00
罗泽轩 01e2494294
Merge pull request #987 from spacewander/fgz
git-bulk: previous refactor redirected $PWD to stderr by mistake
2022-07-22 09:27:10 +08:00
spacewander e3c8359e4e git-bulk: previous refactor redirected $PWD to stderr by mistake
Fix #986
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2022-07-19 14:37:33 +08:00
罗泽轩 9accb6bb04
Merge pull request #983 from SuperSandro2000/patch-1
Fix lazy loading bash_completion from XDG_DATA_DIRS
2022-07-12 09:04:38 +08:00
Sandro 66961ad491
Fix lazy loading bash_completion from XDG_DATA_DIRS
If a bash_completion file should get lazy loaded and is placed in a none standard directory which is listed in XDG_DATA_DIRS it must be placed under share/bash-completion/completions. This is for example used in home-manager.

See 730368b35a/bash_completion (L2531)
2022-07-08 11:49:58 +02:00
罗泽轩 81665422b2
Merge pull request #974 from tfendin/970-standup-author-date
#970 standup added -A flag for author date
2022-07-04 10:40:19 +08:00
Tobias Fendin 48ef95d104 Minor changes to man/git-standup.md 2022-07-01 16:39:27 +02:00
Tobias Fendin bf240df083 Replaced -g and -A with -F gpg|authordate 2022-06-26 12:49:43 +02:00
罗泽轩 d597f684b1
Merge pull request #981 from pbnj/feat/browse-file
feat(bin/git-browse): open website at file & line number or range
2022-06-13 09:02:53 +08:00
Peter Benjamin 7acc1de7fa
fix(bin/git-browse): fix commit hash
Retrieving commit hashes with the following command is not very reliable for
users who sign their commits with gpg/ssh keys:

```
git log -n1 --format=format:"%H" "${filename}" 2>/dev/null
```
2022-06-09 19:44:02 -07:00
Peter Benjamin 8a6e39d589
fix(bin/git-browse): fix bitbucket url 2022-06-09 19:32:47 -07:00
Peter Benjamin 006549d661
feat: open website at file & line number or range
Ported from
f544dadf88/git/bin/git-browse

Closes #980
2022-06-09 19:26:55 -07:00
Tobias Fendin 233b3f0dd4 #970 standup added -A flag for author date 2022-05-14 15:17:58 +02:00
罗泽轩 fdf89cd93f
Merge pull request #972 from wpwoodjr/master
update git-utimes.{1,html} to add --newer flag
2022-05-11 14:12:06 +08:00
Bill Wood 95c54f6cdb update docs due to formatting error in git-utimes man page 2022-05-10 20:03:55 -04:00
Bill Wood 34237934d4 update per shellcheck advice 2022-05-10 19:42:12 -04:00
Bill Wood 8c744569c4 update git-utimes.{1,html} to add --newer flag 2022-05-10 15:30:28 -04:00
罗泽轩 458cb9fdad
Merge pull request #966 from tfendin/git-standup-implicit-week
Added config git-extras.standup-implicit-week for git standup
2022-05-09 13:06:33 +08:00
罗泽轩 12b27415ea
Merge pull request #969 from wpwoodjr/master
`git-utimes`: add --newer flag and don't touch files in the working tree and index
2022-05-09 13:04:40 +08:00
Tobias Fendin 0701c9e4d7 Don't read git-extras.standup.implicit-week twice in git standup 2022-05-07 12:31:16 +02:00
Bill Wood 42fd8a9e72 quote mod_s and git_s integer vars 2022-05-06 08:33:30 -04:00
Bill Wood 311edadd55 Merge branch 'master' of https://github.com/wpwoodjr/git-extras 2022-05-05 11:21:41 -04:00
Bill Wood d8dd44d8eb
Merge branch 'tj:master' into master 2022-05-05 11:21:07 -04:00
Bill Wood 41df8dc7f3 updates per request of spacewander 2022-05-05 11:19:30 -04:00
Bill Wood 48beb58670
Update Commands.md
Co-authored-by: 罗泽轩 <spacewanderlzx@gmail.com>
2022-05-05 10:43:48 -04:00
罗泽轩 5e07a96c57
Merge pull request #965 from tfendin/document-git-standup-w
Document git standup -w option
2022-05-05 11:03:53 +08:00
Bill Wood 3ef09dac72
Merge branch 'tj:master' into master 2022-05-02 09:17:00 -04:00
Bill Wood 799aa6e19a allow modification date updates for symbolic links 2022-05-01 22:01:57 -04:00
Bill Wood aa6b547f55 add --newer flag and ignore files in the working tree or index 2022-05-01 16:48:57 -04:00
Tobias Fendin f334dff09c Documented config git-extras.standup.implicit-week 2022-04-29 14:01:10 +02:00
Tobias Fendin 055110dd35 Minor change to git standup -w documentation 2022-04-29 11:08:51 +02:00
Tobias Fendin 745c7ab500 Improved check if -w or -d was given to git standup 2022-04-29 11:04:04 +02:00
Tobias Fendin 7cb5c55e13 Renamed config git-extras.standup.implicit-week from
git-extras.standup-implicit-week
2022-04-29 09:56:26 +02:00
罗泽轩 0d7334a63f
Merge pull request #967 from SukkaW/replace-git-io
docs(instllation): replace `git.io`
2022-04-29 14:24:41 +08:00
Tobias Fendin 5754b81047 Documented weekend behaviour of git standup -w 2022-04-28 19:24:12 +02:00
SukkaW 2aadd3ed41 docs(instllation): replace git.io 2022-04-28 11:31:59 +08:00
spacewander d2a09c1753 Bump version to 6.5.0-dev
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2022-04-27 21:06:07 +08:00
Tobias Fendin c7756455cb Added config git-extras.standup-implicit-week for git standup 2022-04-26 15:45:59 +02:00
Tobias Fendin 4fcd233bf2 Document git standup -w option 2022-04-26 15:24:43 +02:00
spacewander a73c19c14b Version 6.4.0
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2022-04-22 16:32:01 +08:00
罗泽轩 6bf2b0bc4c
Merge pull request #964 from spacewander/bro
git-browse/browse-ci: use powershell.exe only when it is available
2022-04-22 16:05:26 +08:00
spacewander d17f02979e git-browse/browse-ci: use powershell.exe only when it is available
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2022-04-19 20:51:22 +08:00
罗泽轩 716459f79d
Merge pull request #944 from SimonTate/feature/sem-ver-prefix
git-release: Add prefix to semver
2022-04-18 15:06:34 +08:00
罗泽轩 02263ca949
Merge pull request #957 from jackwasey/quiet-or-stderr
quiet option, errors to stderr
2022-04-18 15:06:04 +08:00
Simon Tate 613b909765 git-release: Add prefix to semver
To allow different release names other than specifically mm.vv.pp, this
adds the ability to use a prefix too.

For example, you can use:

```
$ git release --semver minor --prefix "prefix-"
```

This would allow the previous tags to be in the form `prefix-0.1.0`. A
more obvious use case for this would be a single letter, such as `v` or
`r` to use tags like: `r0.1.0` or `v0.1.0`.
2022-04-15 13:13:02 +01:00
罗泽轩 f556430122
Merge pull request #959 from pbnj/feat/git-browse-ci
feat: implement git-browse-ci
2022-04-13 20:14:53 +08:00
Peter Benjamin 9390d450aa fix: fix stderr & stdout redirect 2022-04-11 08:51:21 -07:00
罗泽轩 3d6f9456a3
Merge pull request #962 from spacewander/gicc
tweak git-ignore/ignore-io
2022-04-11 19:38:56 +08:00
spacewander 27ee8f0132 git-ignore-io: make sure .gi_list is created before access 2022-04-08 21:08:52 +08:00
spacewander 678a0c2e71 git-ignore: the directory of target file may not exist
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2022-04-08 21:08:29 +08:00
Peter Benjamin 11a2801231 fix(git-browse-ci): set pipefail 2022-03-20 18:53:05 -07:00
Peter Benjamin d7565ee844 docs: fix docs 2022-03-19 20:03:44 -07:00
Peter Benjamin 02bbdba792 chore: update docs & completions 2022-03-19 20:00:57 -07:00
Peter Benjamin f513f58d9e feat: implement git-browse-ci 2022-03-19 19:39:03 -07:00
Jack O. Wasey c036c9cc22 quiet option, errors to stderr 2022-03-17 13:25:02 -04:00
罗泽轩 42458d838b
Merge pull request #956 from tfendin/xargs-conflicting-args 2022-03-01 11:44:14 +08:00
Tobias Fendin b2794c18a1 Removed xargs from git-effort 2022-02-25 16:45:54 +01:00
罗泽轩 760428fa46
Merge pull request #955 from katrinleinweber/summary-highlight-path-opt 2022-02-03 15:01:25 +08:00
Katrin Leinweber 76a3c1f28d Highlight path option more 2022-01-30 11:45:03 +01:00
罗泽轩 2025ebfb96
Merge pull request #951 from tfendin/local-commits-all-remotes 2022-01-06 11:50:40 +08:00
Tobias Fendin 5467c2ff5a Updated manual for git local-commits, must track a branch 2022-01-04 17:55:24 +01:00
罗泽轩 843b958c9a
Merge pull request #946 from tfendin/default_branch_logic 2022-01-04 14:11:56 +08:00
Tobias Fendin 7aa178acc9 Made local-commits work with all remotes 2022-01-03 16:45:09 +01:00
Tobias Fendin 2d722c93b8 Updated Readme.md after review 2022-01-03 16:13:28 +01:00
罗泽轩 b772251074
Merge pull request #949 from tfendin/git-ignore-ensure-newline 2022-01-03 21:24:34 +08:00
Tobias Fendin 777fcade17 Added section about main branch to the Readme file 2022-01-01 12:34:22 +01:00
罗泽轩 e370b19190
Merge pull request #947 from tfendin/git-unlock-synopsis-fix 2021-12-31 14:44:36 +08:00
罗泽轩 82b33ac4c7
Merge pull request #948 from tfendin/git-ignore-core-excludesFile 2021-12-31 14:43:55 +08:00
tfendin fff5fde917
Clarified comment of when newline should be added
Co-authored-by: 罗泽轩 <spacewanderlzx@gmail.com>
2021-12-30 12:47:29 +01:00
Tobias Fendin edffba3c2a Updated git-extras manual after review. 2021-12-30 12:41:28 +01:00
Tobias Fendin 11640196b2 git-ignore: ensure new patterns comes after a newline 2021-12-29 15:07:19 +01:00
Tobias Fendin 6b0ef19caf Fixed bug in git-ignore which ignored config core.excludeFiles 2021-12-29 14:33:28 +01:00
Tobias Fendin d914ed3a89 Spell corr in git-unlock synopsis 2021-12-29 14:08:57 +01:00
Tobias Fendin b2743d785f Consider init.defaultBranch in git_extra_default_branch, changed default
branch to main.
2021-12-29 13:57:12 +01:00
罗泽轩 2370a4e27b
Merge pull request #885 from spacewander/add_pkg 2021-11-26 12:47:16 +08:00
spacewander 2fdd664594 doc: add packaging status 2021-11-23 09:40:20 +08:00
罗泽轩 b33ec65e5f
Merge pull request #940 from overengineer/feature/magic
git-magic: Automated commit messages
2021-10-10 12:09:51 +08:00
overengineer 3f2ad3fa8f Ignored error when git restore --staged fails when there is no commit 2021-10-08 07:36:29 +03:00
overengineer e0101470ca Merge branch 'master' into merge/magic 2021-10-08 07:15:16 +03:00
overengineer 86bb1a6764 Added git-magic command 2021-10-08 07:05:50 +03:00
spacewander 96890821b0 Bump version to 6.4.0-dev 2021-10-03 21:25:29 +08:00
spacewander 0c0be92445 Version 6.3.0 2021-10-02 13:25:45 +08:00
罗泽轩 cc9b972e25
Merge pull request #942 from spacewander/ffgd 2021-10-02 13:06:40 +08:00
spacewander 760e64b864 git-delete-squashed-branches: fail fast if can't checkout 2021-10-01 20:04:28 +08:00
罗泽轩 f6fa554077
Merge pull request #939 from SimonTate/feature/force-clear
git-clear: add force option
2021-09-16 15:16:20 +08:00
Simon Tate bc8876b063 git-clear: add force option
Add a new -f/--force option to git-clear to allow usage in scripts,
or without user input.

Add -h/--help/? for help

Also update the manual for git-clear for these changes.
2021-09-14 13:45:50 +01:00
罗泽轩 c30ac80d72
Merge pull request #936 from tfendin/multiline_synopsis_fix
Format fix of Synopsis in manuals
2021-08-19 11:27:18 +08:00
罗泽轩 4de7b34c9f
Merge pull request #937 from tfendin/dedup_email_case_insensitive
Compare email adresses case insensitive in --dedup-by-email
2021-08-17 08:59:46 +08:00
罗泽轩 0edcf8b7e6
Merge pull request #934 from tfendin/no-merge-summary
No merge summary
2021-08-17 08:59:30 +08:00
Tobias Fendin 5feb0db212 Adopted git --dedup-by-email to the project coding style 2021-08-14 14:44:21 +02:00
Tobias Fendin 703a8481c6 summary --dedup-by-email now compares email adresses case insensitive. 2021-08-12 22:05:22 +02:00
Tobias Fendin 3413eeb058 Updated lines under Synopsis in the manuals so they are commonly formatted 2021-08-11 17:33:01 +02:00
Tobias Fendin a7b7f05b5b Add incompability check for git summary --line --no-merges, split synopsis in its manual. 2021-08-11 16:38:21 +02:00
罗泽轩 a07c5ece5d
Merge pull request #935 from ax1036/git-un-lock
fix git (un)lock with spaced filenames
2021-08-11 21:22:48 +08:00
ax1036 296f2a7ad2 fix git (un)lock with spaced filenames 2021-08-10 14:17:33 +02:00
Tobias Fendin e9708ba9f4 Updated completion for git summary 2021-08-07 17:31:51 +02:00
Tobias Fendin 3c91de7a1e Updated documentation for git-summary --no-merges 2021-08-07 17:31:51 +02:00
Tobias Fendin 3c632d9e32 Added option --no-merges to git summary 2021-08-07 17:31:49 +02:00
罗泽轩 3821b2c537
Merge pull request #932 from spacewander/git-su
git-summary: support filtering `--line` with path
2021-07-22 10:51:02 +08:00
spacewander ffad35c8db git-summary: support filtering --line with path 2021-07-09 17:57:30 +08:00
罗泽轩 d28ad34bcb
Merge pull request #865 from pkitszel/pkitszel-git-abort 2021-07-08 15:00:15 +08:00
Przemek Kitszel b8e58ee9ba Add git-abort
New subcommand just calls git $op --abort, where $op is current git operation, like rebase
2021-07-05 23:43:39 +02:00
罗泽轩 b225ed4934
Merge pull request #928 from duckunix/master 2021-06-09 21:03:33 +08:00
Don Harper 30383f9551 Update point to github docs for forks from API 2021-06-07 20:12:22 -05:00
Don Harper 1f72512ef0 update working 2021-06-06 21:26:01 -05:00
Don Harper b8b02d8ef1 git-fork | Update man/md/html pages to talk about need of the github personal access token 2021-06-04 23:04:31 -05:00
Don Harper d8b1007f68 Updated documentation (AUTHORS) 2021-06-04 20:12:41 -05:00
Don Harper 64993dbc7f bin/git-fork | updating for feedback from PR #928
Added support for pulling personal-access-token, borrowing from git-pull-request
2021-06-04 20:08:07 -05:00
Don Harper 4a4c5296f3 git-fork | update to match REST-API auth standards as of 2021-06
- Removed prompt for OATH Token
- Change prompt from 'password' to 'GitHub Personal Access Token'
2021-06-03 20:19:56 -05:00
罗泽轩 206fe7ccfb
Merge pull request #926 from nicokosi/patch-1 2021-06-02 09:40:28 +08:00
Nicolas Kosinski f1eab6a8a7
Update install doc: Homebrew is not just for macOS
I can confirm it also works Linux. I just installed `git-extras` via `Homebrew` on my Ubuntu machine:
```sh
$ uname -srv
Linux 5.8.0-53-generic #60~20.04.1-Ubuntu SMP Thu May 6 09:52:46 UTC 2021

$ brew install git-extras
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/cask and homebrew/core).
==> New Formulae
code-minimap              principalmapper           pywhat
==> Updated Formulae
Updated 70 formulae.
==> Updated Casks
Updated 36 casks.

==> Downloading https://ghcr.io/v2/linuxbrew/core/git-extras/manifests/6.2.0
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/linuxbrew/core/git-extras/blobs/sha256:5a86
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/
######################################################################## 100.0%
==> Pouring git-extras--6.2.0.x86_64_linux.bottle.tar.gz
==> Caveats
To load Zsh completions, add the following to your .zshrc:
  source /home/linuxbrew/.linuxbrew/opt/git-extras/share/git-extras/git-extras-completion.zsh
==> Summary
🍺  /home/linuxbrew/.linuxbrew/Cellar/git-extras/6.2.0: 146 files, 388.4KB
```
2021-06-01 14:58:26 +02:00
罗泽轩 cd8fe4f6e2
Merge pull request #924 from allejo/feature/delete-squashed-branches 2021-05-27 20:13:41 +08:00
Vladimir Jimenez bebcbd11ca
delete-squashed-branches: Make side-effect clear in docs 2021-05-25 20:50:04 -07:00
Vladimir Jimenez fb1e5db6d7
delete-squashed-branches: Make branch checkout side effect clear 2021-05-24 13:55:32 -07:00
Vladimir Jimenez 910242c92b
Add delete-squashed-branches command 2021-05-24 00:13:57 -07:00
罗泽轩 48b2c8fd37
Merge pull request #923 from CleanMachine1/patch-1 2021-05-24 12:16:20 +08:00
CleanMachine1 d86abec6a2
Picture is broken 2021-05-22 19:57:11 +01:00
罗泽轩 1894f453f6
Merge pull request #920 from matan129/patch-1 2021-04-22 15:16:20 +08:00
Matan Rosenberg c35c84a279
Ignore checked-out branches on different worktrees 2021-04-20 09:49:23 +03:00
罗泽轩 a62a67ef5f
Merge pull request #917 from heirecka/remove-git-line-summary-man-page
doc: Remove man page for git-line-summary
2021-03-27 10:21:50 +08:00
spacewander d0c40851c0 Bump version to 6.3.0-dev 2021-03-27 10:11:31 +08:00
Heiko Becker 52ada403ef doc: Remove man page for git-line-summary
git line-summary was deprecated in favour of git summary --line and
removed with d4de567ca7.
2021-03-26 23:59:33 +01:00
spacewander b9786c763f Version 6.2.0 2021-03-26 11:09:34 +08:00
罗泽轩 6880198fda
Merge pull request #915 from spacewander/typo 2021-03-26 10:30:54 +08:00
罗泽轩 687a5607dc
Merge pull request #914 from spacewander/xch 2021-03-26 10:30:40 +08:00
罗泽轩 7b1a062e93
Merge pull request #916 from spacewander/utimes
fix(git-utimes): make sure it work under OS X.
2021-03-26 10:30:27 +08:00
spacewander 6a15a5339b fix(git-utimes): make sure it work under OS X. 2021-03-25 14:50:13 +08:00
spacewander a424d0915e chore: fix typo 2021-03-25 11:40:23 +08:00
spacewander 458727bafb fix(git-ignore): use $XDG_CONFIG_HOME only when it is defined 2021-03-25 11:31:11 +08:00
罗泽轩 d7b527c1ae
Merge pull request #910 from 0xflotus/patch-1
docs: fix typo
2021-03-13 21:50:37 +08:00
0xflotus 0fad3cfd03
fixed small error 2021-03-12 22:46:38 +01:00
hemanth.hm 7d9e05062e
Merge pull request #908 from nodeg/fix_installation
Minor fixes for Installation.md
2021-03-08 13:01:37 -08:00
Dominik Gedon c8d9374491
Fix grammer 2021-03-05 18:27:30 +01:00
Dominik Gedon f3028db073
Correct macOS spelling 2021-03-05 18:25:35 +01:00
Dominik Gedon d73bfbb98b
Correct openSUSE spelling and update Version 2021-03-05 18:24:15 +01:00
hemanth.hm 42e1f9d5c6
Merge pull request #907 from bbenzikry/zinit-docs
Update zplugin docs --> zinit
2021-03-01 22:13:22 -08:00
Beni Ben Zikry b7841ad3aa
Update zinit docs 2021-03-01 10:18:43 +02:00
罗泽轩 4ea6cf0221
Merge pull request #906 from prestontim/master
Remove bug|refactor|chore from documentation
2021-03-01 09:59:33 +08:00
Tim Preston 8f60fb29f4 Remove bug|refactor|chore from documentation 2021-02-26 11:10:56 -06:00
罗泽轩 96b95392ac
Merge pull request #899 from spacewander/git-summary
git-summary: reject invalid option
2020-12-24 16:04:25 +08:00
spacewander 16c1f0d3dc git-summary: reject invalid option
Argument starts with '-' can't be committish, so we can safely reject
it.
2020-12-16 18:01:30 +08:00
spacewander c675d0afb8 ci: use checkout@v2 2020-12-14 11:19:15 +08:00
罗泽轩 4c82bbecc3
Merge pull request #897 from spacewander/ga
ci: move to GitHub Action
2020-12-14 10:26:38 +08:00
spacewander faa56b1bcb ci: move to GitHub Action 2020-12-14 10:25:51 +08:00
罗泽轩 e6caa931a5
Merge pull request #882 from vt-alt/git-utimes
git-utimes: Change files modification time to their last commit date
2020-11-29 11:40:12 +08:00
罗泽轩 6b45d4322b
Merge pull request #896 from Aloxaf/fix_completion
fix: zsh completion of git-coauthor command
2020-11-27 09:49:02 +08:00
Aloxaf e92d54cadb
fix: zsh completion of git-coauthor command 2020-11-26 22:30:05 +08:00
罗泽轩 444722cf38
Merge pull request #895 from vanpipy/feature/optional-start-point-when-creeate-branch
feat(#861): add optional parameter --from to set the start point
2020-11-21 11:25:08 +08:00
vanpipy b2b5c97105 doc: add the usage of the parameter --from for create-branch and feature 2020-11-19 13:46:10 +08:00
vanpipy d3772eb469 feat(feature): checkout from start point if exists 2020-11-19 09:16:37 +08:00
vanpipy 41732e4113 feat(create-branch): add optional --from to set the start point 2020-11-19 09:16:33 +08:00
罗泽轩 18bcfcd38e
Merge pull request #894 from alessandro308/merge-into-stashed
Merge-into: add stash before to checkout
2020-11-16 19:16:18 +08:00
Alessandro Pagiaro aa5a380996 Merge-into: add stash before to checkout 2020-11-16 11:33:59 +01:00
罗泽轩 68e6a15401
Merge pull request #892 from equt/#891
[ fix #891 ] Cast branch output if HEAD not exists
2020-11-14 10:19:04 +08:00
罗泽轩 05ce91fb9e
Merge pull request #888 from equt/master
Add support for XDG specifications
2020-11-14 10:17:53 +08:00
罗泽轩 d2a159ed25
Merge pull request #889 from vanpipy/feature/delete-tag
feat(delete-tag): get default remote from git config if exists
2020-11-12 09:19:00 +08:00
equt f66f7e484f
[ fix #891 ] Cast branch output if HEAD not exists 2020-11-11 22:38:19 +08:00
equt fca42774f8
[ feat ] Quote the default_path var 2020-11-11 22:30:10 +08:00
equt ef13ed06a3
[ fix ] Quote env var 2020-11-11 22:30:10 +08:00
equt fa35cdab99
[ fix ] Quote the XDG_CACHE_HOME 2020-11-11 22:30:10 +08:00
equt 8ed7da3f02
[ feat ] Use default global ignore file 2020-11-11 22:30:10 +08:00
Sinos 54f8205478
[ refactor ] Optimize var not existing check
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2020-11-11 22:30:10 +08:00
equt 19531065ca
[ fix ] Fix hardcode ignore list file path 2020-11-11 22:30:10 +08:00
equt 4f5b5ccd48
[ feat ] Add XDG_CACHE_HOME check 2020-11-11 22:30:09 +08:00
罗泽轩 ad8c77bfa3
Merge pull request #890 from zhujian0805/master
adding a format for git-contrib
2020-11-08 22:25:30 +08:00
James Zhu 8490a50304 adding a format for git-contrib 2020-11-08 20:21:32 +08:00
Vitaly Chikunov aa174b3905 git-utimes: Change files modification time to their last commit date
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2020-11-08 14:04:41 +03:00
vanpipy c006e5ece8 feat(delete-tag): get default remote from git config if exists 2020-11-08 10:41:50 +08:00
罗泽轩 171d06965e
Merge pull request #884 from elonderin/fix-squash-help
Updates git-squash.md: fixes help which was unclear and had remnants …
2020-10-14 09:14:58 +08:00
thomas menzel 6d9f861d0e squash help: re-ran make for extras and squash 2020-10-13 23:57:56 +02:00
thomas menzel 041e3fd8da squash help: ran make man/git-extras.{html,1} 2020-10-12 23:37:15 +02:00
thomas menzel 35d544b8c6 squash help: ran make man/git-squash.{html,1} 2020-10-12 07:45:57 +02:00
tom da34968ec3 squash help: corrects option name in PR 2020-10-11 14:16:52 +02:00
thomas menzel 35d44c97cc Merge remote-tracking branch 'u/master' into HEAD 2020-10-11 14:12:32 +02:00
罗泽轩 317eea64db
Merge pull request #886 from TheTechOddBug/master
Fixing summary for --squash-msg option.
2020-10-10 09:09:50 +08:00
José María Gutiérrez @TheTechOddBug 2ef6ea4b96 Fixing summary for --squash-msg option. 2020-10-10 01:08:32 +02:00
elonderin c41f0164cc Updates git-squash.md: fixes help which was unclear and had remnants from copied template it appears 2020-10-05 17:00:02 +02:00
spacewander 3cc866dd97 Bump version to 6.2.0-dev 2020-09-28 17:47:23 +08:00
spacewander 2929c41637 Version 6.1.0 2020-09-26 20:11:50 +08:00
罗泽轩 64e76db350
Merge pull request #878 from spacewander/default_br
change: migrate default branch
2020-09-26 19:58:06 +08:00
罗泽轩 74fe4f6aba
Merge pull request #880 from spacewander/fix_bsd_sed_regex
git-info: fix regex for bsd sed
2020-09-25 15:22:26 +08:00
spacewander 2e610158a8 git-info: fix regex for bsd sed 2020-09-24 23:10:23 +08:00
罗泽轩 65be1e5f8f
Merge pull request #879 from spacewander/pass_arg
feat: pass origin argument down to git execution
2020-09-24 17:22:42 +08:00
spacewander 9683fb6510 feat: pass origin argument down to git execution 2020-09-24 09:40:43 +08:00
spacewander 964663f1a4 change: migrate default branch
Close #877.
2020-09-23 16:19:41 +08:00
罗泽轩 e9668cc04b
Merge pull request #872 from yuravg/pr_typo
git-pr: fix doc format
2020-09-11 09:47:05 +08:00
Yuriy VG 8a487271cb doc: fix typo 2020-09-10 22:20:18 +03:00
罗泽轩 1a4cd4ca3d
Merge pull request #869 from spacewander/typo
remove git-back
2020-08-29 22:50:07 +08:00
spacewander e116406ff1 git-back: removed 2020-08-28 22:23:41 +08:00
spacewander 34ba1eb083 fix typo 2020-08-27 11:03:06 +08:00
罗泽轩 6a455e7d29
Merge pull request #868 from spacewander/zsh_completion
Zsh completion
2020-08-27 10:40:41 +08:00
spacewander 6afc2fb4a8 sort completion in alphabetical order 2020-08-25 14:53:11 +08:00
spacewander c56b61d2bd remove incorrect completion 2020-08-25 14:50:56 +08:00
spacewander c386733efd git-info: add zsh completion 2020-08-25 14:45:12 +08:00
罗泽轩 ecf0f4847f
Merge pull request #867 from yuravg/pr2source
Improved the 'git-info' command (color, submodule, config)
2020-08-25 11:21:58 +08:00
Yuriy VG e031dc54e9 doc: fix argument description 2020-08-24 11:34:11 +03:00
Yuriy VG 8e519e3e66 git-info: moved argument checking 2020-08-24 11:09:27 +03:00
Yuriy VG c52ba59d10 git-info: fix namespace
should use 'git-extra' name to configure via git config options.
2020-08-24 10:48:50 +03:00
Yuriy VG 9ee5d06469 doc: update derived git-info files 2020-08-21 19:22:07 +03:00
Yuriy VG ec417833ee doc: add description for git-info 2020-08-21 19:22:07 +03:00
Yuriy VG b4b81e290e Add bash completion for git-info 2020-08-21 19:22:07 +03:00
Yuriy VG c92f03d303 git-info: colorized headers 2020-08-21 19:22:04 +03:00
Yuriy VG af06d49c33 git-info: extend configuration and commit information
add ability to customize git-config, git-log commands from .gitconfig file
2020-08-21 17:57:07 +03:00
Yuriy VG e7270b3667 git-info: remove notes about git-log, git-show
auxiliary message distracting from the main message
2020-08-21 16:14:54 +03:00
Yuriy VG 87cff6d5cb git-info: add info about submodules 2020-08-21 16:10:06 +03:00
Yuriy VG aaf9ef343b git-info: fix indentation, remove comment 2020-08-21 16:01:11 +03:00
罗泽轩 73cc666030
Merge pull request #864 from v-y-a-s/pr
Updated the git pull-request command to use personal access token instead of basic auth.
2020-08-11 09:14:11 +08:00
vyas eaeeef3b80 Grammar correction 2020-08-07 11:16:00 +05:30
vyas 73bb1e0f59 Remove $user 2020-08-06 13:06:28 +05:30
vyas 238038139d corrections 2020-08-06 13:03:13 +05:30
vyas 85e1c4ff0a Update doc 2020-08-05 16:53:36 +05:30
vyas a0d7039482 fix config message name 2020-08-05 16:22:44 +05:30
vyas 49a34037ad Remove comments 2020-08-05 16:19:51 +05:30
vyas 2dc9c26e36 PR test 2020-08-05 11:59:43 +05:30
罗泽轩 2f3772b09a
Merge pull request #860 from soraxas/implement-fish-completions
Implement fish completions file
2020-07-30 09:31:21 +08:00
Tin Lai 4a7fcb7d1c
implement fish completions file
Signed-off-by: Tin Lai <oscar@tinyiu.com>
2020-07-27 15:45:37 +10:00
罗泽轩 6e77d950eb
Merge pull request #853 from bethesque/feat/git-browse-with-multiple-remotes
feat(browse): select remote of current branch, fallback to origin
2020-07-27 09:24:28 +08:00
Beth Skurrie 572ae0dd46
feat(browse): automatically select origin remote if one exists, fallback to first otherwise 2020-07-26 08:22:43 +10:00
罗泽轩 a0a32abc0b
Merge pull request #854 from bethesque/fix/git-browse-sed-on-mac
fix(browse): update sed pattern to work on mac
2020-06-23 10:08:03 +08:00
Beth Skurrie edf7b060d2
fix(browse): update sed pattern to work on mac 2020-06-23 09:31:21 +10:00
spacewander 2076ac9c38 Bump version to 6.1.0-dev 2020-06-22 21:31:49 +08:00
spacewander 4c9d59059e Version 6.0.0 2020-06-22 11:18:23 +08:00
spacewander 97de52a3be doc: remove gitter
We don't hang on it any more.
2020-06-22 10:59:20 +08:00
spacewander a994411e58 git-cp: remove trailing space 2020-06-22 09:59:59 +08:00
罗泽轩 f06ba9f70b
Merge pull request #849 from vr8hub/undodoc
Correct undo documentation to match code order of parameters
2020-06-21 17:42:22 +08:00
罗泽轩 5a79873bd6
Merge pull request #850 from vr8hub/newundo
Modify to work when only a single commit, add parameter checks
2020-06-21 17:41:33 +08:00
vr8ce 27f42beb81 Tighten numeric regex 2020-06-19 22:56:55 -05:00
vr8ce 6ccd2fa439 Cleanup code 2020-06-18 23:38:55 -05:00
vr8ce 9dca93eeb2 Modify to work when only a single commit, add parameter checks 2020-06-17 20:11:07 -05:00
vr8ce 11cc90d5f6 Correct undo documentation to match code order of parameters 2020-06-15 23:13:05 -05:00
罗泽轩 90495d0d5e
Merge pull request #847 from Amorymeltzer/patch-1
docs: Note flag for git extra --version
2020-06-05 09:27:27 +08:00
Amory Meltzer f2136ec433
docs: Note flag for git extra --version 2020-06-04 14:53:23 -04:00
罗泽轩 a04f27b255
Merge pull request #846 from spacewander/note
doc: add a note about the package maintainer.
2020-06-04 15:30:58 +08:00
spacewander f27875d5bc doc: add a note about the package maintainer. 2020-05-31 11:31:25 +08:00
罗泽轩 cb66d36434
Merge pull request #844 from ihoro/installation-via-freebsd-pkg
docs: mention installation via FreeBSD pkg
2020-05-31 11:13:21 +08:00
罗泽轩 d4ff718ac3
Merge pull request #843 from spacewander/remove_git_feature
break change: remove docs and other stuff of git-feature's alias
2020-05-31 11:10:57 +08:00
spacewander 23fcac8c4f break change: remove docs and other stuff of git-feature's alias 2020-05-31 11:03:11 +08:00
罗泽轩 fa8165ba7e
Merge pull request #845 from alerque/remove-feature-aliases
Remove scripts that are mere alias wrappers for git-feature
2020-05-31 11:00:15 +08:00
Caleb Maclennan db9ca55c71
Remove scripts that are mere alias wrappers for git-feature
Notably `git-bug` clobbers a very popular other project of the same name.
Having lightweight wrapper scripts clogging up the subcommand namespace
makes it awkward to make use of this project wholesale instead of
piecemeal. These function can be implemented by users with git aliases
very easily.
2020-05-30 15:32:01 +03:00
phigoro 672e330f47 docs: mention installation via FreeBSD pkg 2020-05-30 14:20:10 +03:00
罗泽轩 852e630314
Merge pull request #840 from spacewander/archive-invalid
git-archive-file: rename invalid chars in the output filename
2020-05-27 09:14:57 +08:00
罗泽轩 54199b8d08
Merge pull request #841 from sgleizes/bugfix/git-release-zsh-completion
Fix missing newline escapes in git-release zsh completion
2020-05-25 09:05:25 +08:00
sgleizes edc4814ced Fix missing newline escapes in git-release zsh completion 2020-05-23 13:36:13 +02:00
spacewander 8f133a32ba git-archive-file: rename invalid chars in the output filename
Fix #838.
2020-05-22 10:40:29 +08:00
罗泽轩 4eb4e7ffdb
Merge pull request #837 from jldugger/jldugger/pr-remote-default
add a default for the remote to fetch a pr from
2020-05-16 12:12:21 +08:00
罗泽轩 acf4123234
Merge pull request #836 from jldugger/jldugger/feature-config
add a config setting for prefix
2020-05-15 12:41:57 +08:00
Justin Dugger 9e843da98d add a default for the remote to fetch a pr from 2020-05-14 00:32:48 -07:00
Justin Dugger e8ee36733f add a config setting for prefix 2020-05-14 00:19:54 -07:00
罗泽轩 db3389a3cc
Merge pull request #829 from cpradog/master
add squash option to git-feature
2020-04-05 17:15:02 +08:00
Carlos Prado 3583825137 update zsh completion for bug and refactor commands 2020-04-05 03:32:27 +02:00
Carlos Prado 31079e0a60 updated zsh completion script 2020-04-05 03:29:24 +02:00
Carlos Prado 45eed8f166 updated git-feature documentation 2020-04-05 02:43:59 +02:00
Carlos Prado c038741194 add squash option to git-feature 2020-04-04 00:28:29 +02:00
Carlos Prado 63eaba4572 add squash option to git-feature 2020-04-04 00:27:58 +02:00
罗泽轩 f2a3e50cab
Merge pull request #826 from Natim/feature/825/add-git-cp
Add git-cp
2020-03-23 15:19:27 +08:00
Rémy HUBSCHER 91b3e47243
Simplify the code. 2020-03-20 14:11:17 +01:00
Rémy HUBSCHER b85fc019ca
Signal if the destination already exists. 2020-03-20 09:43:24 +01:00
Rémy HUBSCHER 2c9b071fde
@spacewander review. 2020-03-20 09:37:43 +01:00
罗泽轩 6e83793dda
Merge pull request #827 from Natim/fix-man-page-for-git-psykorebase
Update man page export for git-psykorebase with ronn-ng 0.9.0
2020-03-20 09:14:54 +08:00
Rémy HUBSCHER 2a5c08aaf8
Fix checks. 2020-03-19 16:59:09 +01:00
Rémy HUBSCHER 5afaa731e0
Update man page export for git-psykorebase with ronn-ng 0.9.0 2020-03-19 16:57:51 +01:00
Rémy HUBSCHER bea25d1ceb
@mschneiderwind review. 2020-03-19 16:11:39 +01:00
Rémy HUBSCHER 739ca052b4
Add documentation. 2020-03-19 16:10:20 +01:00
Rémy HUBSCHER 629fc03581
Add first version of git-cp 2020-03-19 15:49:07 +01:00
罗泽轩 dd0337c3cf
Merge pull request #824 from mapitman/master
Fix documentation for git-browse
2020-03-19 11:30:58 +08:00
Mark Pitman 6b4188404b Fix documentation for git-browse 2020-03-18 09:55:40 -07:00
罗泽轩 79ae65fe64
Merge pull request #823 from mapitman/master
Add git-browse command
2020-03-18 14:06:33 +08:00
Mark Pitman f6cf59c380 Implement suggested changes from code review
Use bash string replacement instead of sed for simple replacement
Use http URLs instead of https (sites that reuqire https should be
auto-redirecting anyway)

 #666
2020-03-17 21:12:07 -07:00
Mark Pitman 362a0c29ae Add git-browse command
Handles git@server and https://server remotes.
Allows specification of the remote to open
Closes #666
2020-03-15 01:40:09 -07:00
罗泽轩 be50c2f3f5
Merge pull request #820 from spacewander/deprecate_git_back
change: deprecate git-back
2020-02-25 21:23:29 +08:00
spacewander 3917c774ec change: deprecate git-back
Thanks @vr8hub for the report.

git-back will be removed in the next next release.
2020-02-23 11:41:54 +08:00
罗泽轩 b708a8a4d3
Merge pull request #817 from bric3/adds-git-brv
Fixes #770: Adds git-brv
2020-01-15 18:09:48 +08:00
Brice Dutheil 80cd52701e
Fixes #770: Adds git-brv 2020-01-15 10:46:19 +01:00
罗泽轩 265b03e400
Merge pull request #816 from spacewander/git-sed-pathspec
git-sed: limit paths via pathspec
2020-01-08 10:08:37 +08:00
spacewander 4b9f1619f6 git-sed: limit paths via pathspec 2020-01-03 18:22:34 +08:00
spacewander 6438dee914 Bump version to 5.2.0-dev. 2019-12-23 18:28:13 +08:00
spacewander 2a65a7aa8b Version 5.1.0 2019-12-21 13:53:03 +08:00
罗泽轩 2c689db6d7
Merge pull request #813 from spacewander/release-fix
some fixes before release
2019-12-21 13:42:51 +08:00
spacewander 2067d26276 git-bulk: support cloning from a relative path 2019-12-21 13:35:59 +08:00
spacewander aefa3c9ff6 git-standuo: clarify the -a option 2019-12-21 13:12:10 +08:00
spacewander 3b2f6611d6 git-paste: check pastebinit before running it
We don't force to install pastebinit because it is not widely used in
git-extras.
2019-12-20 22:08:02 +08:00
spacewander ecff5e1a3c git-coauthor: quote variable in the comparison 2019-12-20 18:22:06 +08:00
spacewander eb33c9bf5a git-bulk: don't disappoint shellcheck 2019-12-20 18:21:29 +08:00
罗泽轩 bd8fa031cc
Merge pull request #812 from spacewander/git-sed-escape
git-sed: escape special characters for tr
2019-12-18 11:25:18 +08:00
spacewander 4d5b53aea2 git-sed: escape special characters for tr
Some special patterns like `n-l`, `[:alpha:]` need to be escaped to avoid
confusing tr.
2019-12-16 22:19:30 +08:00
罗泽轩 69e96cba95
Merge pull request #811 from eli-schwartz/portability
build: do not require the nonstandard and unpredictable 'which' utility
2019-12-13 10:01:41 +08:00
Eli Schwartz e836b6ce4c
build: do not require the nonstandard and unpredictable 'which' utility
This may not be installed on various systems, and it's difficult to test
for the availability of the tool you need, if the check program itself
does not exist.

The POSIX 2008 specification mandates the `command -v` builtin; bash is
a POSIX 2008 compliant shell, and this builtin has worked since bash 1.x
anyway.

A side benefit of using the POSIX portable option is that it requires
neither an external disk executable, nor (because unlike "which", the
exit code is reliable) a subshell fork. This therefore represents a mild
speedup.
2019-12-12 00:13:30 -05:00
Roshak Zarhoun 16bb0df9f9 add repositories to workspace from source (#804)
* make addworkspace clone multiple repositories into ws from list of URLs in a file

* extend usage

* check if source is file or URL

* update Commands.md

* checked allwedargcount function

* resolved merge conflicts and change requests

* update manuals

* change the order of error and usage in allwedargcount()

* improve URL matcher. include also SSH protocol
2019-12-10 21:57:32 +08:00
罗泽轩 bb7d389084
Merge pull request #810 from roxchgt/read-not-need-repo
read COMMANDS_WIHOUT_REPO from not_need_git_repo file
2019-12-10 11:31:22 +08:00
roxchgt 7a66b157f0 read COMMANDS_WIHOUT_REPO from not_need_git_repo file 2019-12-09 17:13:56 +01:00
罗泽轩 2fe53ac791
Merge pull request #806 from spacewander/retire_make_with_msys
retire the msysgit installation script
2019-12-07 19:22:03 +08:00
罗泽轩 d0636d2b07
Merge pull request #808 from drasill/master
git-ignore: support non-default .git directory
2019-12-07 19:13:31 +08:00
Christophe Badoit 41ebe0e0bf git-ignore: support non-default .git directory
useful for submodules.

Closes tj/git-extras#807
2019-12-06 17:23:19 +01:00
spacewander 6b8729a819 retire the msysgit installation script
The Makefile.msys is out of sync. Use install.cmd instead.
2019-12-06 16:44:30 +08:00
罗泽轩 29f6d0e0e0
Merge pull request #802 from spacewander/fix-git-bulk-arg-count
fix bug in allowedargcount() to not execute command if wrong args count
2019-12-05 18:26:57 +08:00
spacewander 83349426d1 git-bulk: line break is need in the SYNOPSIS doc section 2019-12-02 16:10:15 +08:00
roxchgt 45647fdab3 fix bug in allowedargcount() to not execute command if wrong args count 2019-12-01 11:33:59 +08:00
罗泽轩 67c2bf595f
Merge pull request #801 from spacewander/fix-delete-submodule
git-delete-submodule: don't remove the history of deleted submodule
2019-12-01 11:31:22 +08:00
spacewander 4d4b87ccb8 git-delete-submodule: don't remove the history of deleted submodule
This hurted 'git blame' and other git operation which relies on history.

Fix #799.
2019-11-29 17:43:22 +08:00
罗泽轩 292149c46f
Merge pull request #798 from wolviecb/signed_release
Signed release
2019-11-26 17:27:33 +08:00
Tom Andrade 704b1b4fdd Add flags -s and -u for signed tags 2019-11-26 08:31:06 +01:00
罗泽轩 a6a1754093
Merge pull request #795 from spacewander/git-squash-commit-msg
Git squash commit msg
2019-11-05 18:12:43 +08:00
罗泽轩 b0d3a77ac0
Merge pull request #793 from spacewander/git-standup-group-by-branch
git-standup: add option '-B' to group the commits by branch
2019-11-05 17:57:49 +08:00
spacewander 46ea733983 git-squash: miss completion script change 2019-11-05 10:35:36 +08:00
spacewander f4e313d3f2 git-squash: clean up shellcheck warnings 2019-11-05 10:30:37 +08:00
spacewander 1924eb9197 git-squash: add --squash-messages to concat commit messages into one. 2019-11-05 10:28:51 +08:00
spacewander 952d1eb76f git-standup: add option to limit the number of commit 2019-11-04 11:36:29 +08:00
罗泽轩 f2934bd0bd
Merge pull request #789 from go2null/delete-empty-gitmodules
Delete empty gitmodules
2019-11-03 11:42:18 +08:00
spacewander 677f570f34 git-delete-submodule: comment the DUMMY prefix and ignore the output of grep -v. 2019-11-03 11:30:03 +08:00
spacewander 227c19bb67 git-standup: add separate newline between the output 2019-11-03 10:53:40 +08:00
go2null 1f605df053 add PR changes 2019-11-02 04:32:36 -04:00
go2null 17d1a471a4 add --force option to continue on error 2019-11-02 04:32:36 -04:00
go2null f00c1389d6 improve readability 2019-11-02 04:32:36 -04:00
go2null 4f35f8cad8 display git submodule status output before exiting 2019-11-02 04:32:36 -04:00
go2null 5ea4a626a6 check git submodule status before declaring success 2019-11-02 04:32:36 -04:00
go2null 4bb273a802 reorganize flow 2019-11-02 04:32:36 -04:00
go2null 4a47ea034b delete empty .gitmodules 2019-11-02 04:32:36 -04:00
spacewander 7b9fbc4389 git-standup: add option '-B' to group the commits by branch 2019-11-01 17:32:55 +08:00
罗泽轩 2883b67644
Merge pull request #792 from spacewander/git-summary-cleanup
clean up git-summary
2019-11-01 17:16:07 +08:00
spacewander f788c789f3 git-summary: clean up other shellcheck warnings 2019-10-31 18:30:46 +08:00
spacewander 3e8c3ab0c4 git-summary: fix incorrect active days when commits range is given
Previous when commits range is given, we count the active days of whole
history because we didn't pass the argument.
2019-10-31 17:56:41 +08:00
spacewander ff991ac99e git-summary: remove useless result function.
This function was introduced when merging `bin/git-line-summary` into
`bin/git-summary`.
2019-10-31 17:56:41 +08:00
罗泽轩 a14547e92f
Merge pull request #790 from spacewander/git-summary-merge-email
git-summary: add --dedup-by-email to remove duplicate users
2019-10-31 10:01:35 +08:00
spacewander 203f5b48ad git-summary: add --dedup-by-email to remove duplicate users 2019-10-27 09:04:27 +08:00
hemanth.hm 7bdfb1f55f
Merge pull request #788 from spacewander/doc_git_summary_line
git-summary: add missing example of --line option
2019-10-15 13:02:43 -07:00
spacewander cf3e1e7e7d git-summary: add missing example of --line option 2019-10-15 10:13:32 +08:00
罗泽轩 fd36fc0ea2
Merge pull request #787 from rvbuelow/patch-1
Use GIT_DIR environment variable to to set .git directory
2019-10-02 19:23:08 +08:00
罗泽轩 eb9ddbe8a9
Merge pull request #786 from mbologna/patch-1
Docs: add OpenSUSE distribution information
2019-10-02 19:11:00 +08:00
Robin von Bülow 256044c04f
Use GIT_DIR environment variable to to set .git directory 2019-10-02 12:42:14 +02:00
Michele Bologna 0cd55d88bf
Docs: add OpenSUSE distribution information 2019-10-01 20:59:48 +02:00
罗泽轩 bba1f964b8
Merge pull request #784 from spacewander/git-effort-col-len
git-effort: adjust column limit according to the paths
2019-09-25 10:30:31 +08:00
spacewander 7015501161 git-effort: adjust column limit according to the paths
Fix #780.
2019-09-24 14:32:54 +08:00
罗泽轩 ff0b1cfb0b
Merge pull request #708 from pabs3/git-paste
Add git-paste for sending patches to pastebin
2019-09-10 11:24:30 +08:00
Paul Wise d90b02ce22
Regenerate docs
Changes-by: make man/git-paste.{1,html}
2019-09-10 10:40:22 +08:00
Paul Wise 5b62b4a884
Add git-paste for sending patches to pastebin 2019-09-10 10:39:20 +08:00
罗泽轩 f7d127b360
Merge pull request #778 from pabs3/cleanups
Clean up some minor issues detected by check-all-the-things
2019-09-06 14:46:15 +08:00
Paul Wise 1d7d4c2446
Switch from using /tmp to using mktemp
mktemp protects against attacks from other users.
mktemp protects against concurrent writers.
mktemp respects the $TMPDIR environment variable.

Suggested-by: check-all-the-things
2019-09-05 12:41:45 +08:00
Paul Wise a85d5f57bb
Switch http URLs to https where possible
Suggested-by: check-all-the-things
2019-09-05 12:41:45 +08:00
Paul Wise 1a414f5512
Fix typos
Suggested-by: codespell
Suggested-by: spellintian
2019-09-05 12:41:38 +08:00
Paul Wise e24c1302f4
Fix an indefinite article in the documentation
Suggested-by: anorack
2019-09-04 19:35:43 +08:00
罗泽轩 883199093c
Merge pull request #776 from spacewander/update_git_pr_doc
git-pr: mention the limitation of -m option
2019-09-02 11:20:22 +08:00
罗泽轩 6a3d61ff12
Merge pull request #777 from fengkx/zplugin-install-completion
[Doc]Install completion with zplugin
2019-09-02 11:18:55 +08:00
fengkx c4e94a4130 docs(Installation): 📝 add src in zplugin ice modifier to source the completion file 2019-09-01 12:06:13 +08:00
spacewander a921e88d76 git-pr: mention the limitation of -m option 2019-08-30 09:23:08 +08:00
罗泽轩 a56e14488e
Merge pull request #772 from jacobherrington/add-git-coauthor
Add git coauthor command
2019-08-28 18:06:24 +08:00
jacobherrington 55cefa9021 Add conditional logic for linebreaks 2019-08-27 10:52:44 -05:00
jacobherrington 3484df9ca4 Ensure arguments exist 2019-08-23 20:30:18 -05:00
jacobherrington 66288296b2 Add git coauthor command
This adds a feature to add additional authors to the previous commit,
this feature is supported by GitHub and GitLab and based on the format
should be self-evident to anyone reading the commit message.
2019-08-23 20:21:43 -05:00
spacewander 5bffcb4c89 improve the quality of the integrity check. 2019-08-18 11:46:00 +08:00
罗泽轩 4867571df0
Merge pull request #774 from jacobherrington/patch-2
Link to the contributing document
2019-08-18 11:08:18 +08:00
spacewander a2250dd205 Bump version to 5.1.0-dev. 2019-08-18 10:49:54 +08:00
Jacob Herrington f053fc48db
Link to the contributing document 2019-08-17 18:43:55 -05:00
spacewander ebdebadd3b Version 5.0.0 2019-08-16 22:33:27 +08:00
罗泽轩 fa5017a4a5
Merge pull request #769 from spacewander/no_line_summary
git-line-summary: should be the history
2019-07-27 12:20:50 +08:00
spacewander d4de567ca7 git-line-summary: should be the history
Also remove some trailing lines after the output.
2019-07-23 22:13:29 +08:00
罗泽轩 f2587339cf
Merge pull request #768 from bric3/fix-more-character-encoding-issues
git-guilt: protect against encoding issues with LC_ALL=C
2019-07-19 09:28:23 +08:00
Brice Dutheil 2dc5d5104e git-guilt: protect against encoding issues with LC_ALL=C 2019-07-18 15:37:47 +02:00
罗泽轩 500ea2b119
Merge pull request #767 from spacewander/rename_branch_order
git-rename-branch: change branch argument order
2019-07-06 13:08:15 +08:00
spacewander df06f3e3bd git-rename-branch: change branch argument order
Now git-rename-branch has the same order like 'git branch -m', 'git
rename-tag' and other rename command.

Note that this is a break change.

Close #759.
2019-07-06 11:41:47 +08:00
罗泽轩 defa89c794
Merge pull request #765 from spacewander/column_dependency
Installation.md: add dependencies section.
2019-06-30 11:46:51 +08:00
spacewander 58d13f88d4 Makefile: check dependencies before installation.
So that the packager will know what are dependencied when they are
making a new package.
2019-06-27 15:12:30 +08:00
spacewander 85248595e3 Installation.md: add dependencies section. 2019-06-27 12:33:18 +08:00
spacewander 0b49719ae4 man/Readme.md: we don't need to update git-extras docs separately 2019-06-24 10:26:14 +08:00
罗泽轩 3080b81bcc
Merge pull request #763 from spacewander/strict_check_integrity
check_integrity.sh: check more strickly.
2019-06-24 09:50:54 +08:00
spacewander c03e0ad841 check_integrity.sh: check more strickly. 2019-06-22 11:16:09 +08:00
罗泽轩 ac9e35735b
Merge pull request #762 from spacewander/pr_merge
git-pr: add -m|--merge option to check out a merge commit
2019-06-22 10:54:34 +08:00
罗泽轩 a26f1e6f8e
Merge pull request #761 from btmurrell/preference-for-create-branch
`create-branch` allows for preference for `remote` option
2019-06-22 10:54:11 +08:00
Brian Murrell 7d3ab83ec3 implements remote pref for create-branch 2019-06-21 06:20:16 -07:00
spacewander eae05bbb98 git-pr: add -m|--merge option to check out a merge commit
Close #757.
2019-06-17 11:15:12 +08:00
brian murrell 820b7cd41b impl for checking remote pref 2019-06-14 01:35:52 -07:00
hemanth.hm 1712db2146
Merge pull request #754 from spacewander/prompt_passwd_before_2fa
git-fork: prompt for password before 2FA code.
2019-06-03 11:06:59 +05:30
spacewander c3c0bdfbbb git-fork: prompt for password before 2FA code.
Fix #750.
2019-06-02 12:20:09 +08:00
spacewander 4b09e94853 check_integrity.sh: improve readability. 2019-05-25 11:06:03 +08:00
罗泽轩 26447e5bbe
Merge pull request #753 from tiemonl/GH-752_update_reauthor_documentation
git-reauthor: updated documentation to show rename workaround
2019-05-23 09:45:31 +08:00
tiemonl f4f7c1e3b5 GH-752 updated documentation to show rename workaround 2019-05-22 11:22:58 -04:00
罗泽轩 6d1982d6cf
Merge pull request #751 from timfeirg/master
git-rename-remote: rename a remote regardless of any existing remotes
2019-05-08 15:14:15 +08:00
timfeirg ecdd665f1c
git-mv-remote: rename a remote regardless of any existing remotes 2019-05-08 14:08:20 +08:00
Abdullah a214c93ad4 Installation instructions added for CRUX (#746)
Added support for CRUX
2019-03-05 12:17:49 +08:00
罗泽轩 044b06b6cb
Merge pull request #723 from bittner/feature/git-undo-soft-leave-changes-staged
Make `git undo -s` restore the staging area
2019-03-04 19:31:16 +08:00
罗泽轩 5b0a9d22b6
Merge pull request #744 from spacewander/git-guilt-identation
git-guilt: avoid exceeding 80 columns.
2019-02-19 08:47:19 +07:00
spacewander eecfb9af47 git-guilt: avoid exceeding 80 columns. 2019-02-18 13:11:26 +08:00
spacewander 39df4dfa64 Bump version to 4.8.0-dev. 2019-02-09 17:36:46 +08:00
spacewander f355fb4c94 Version 4.7.0 2019-02-09 17:08:42 +08:00
spacewander 7a89f7c6e4 git-pr: emphasized that the remote is required when pulling multiple PRs. 2019-02-09 16:58:31 +08:00
罗泽轩 99238bdf0a
Merge pull request #743 from spacewander/allow_multiple_pr
git-pr supports pulling multiple pr at once
2019-02-08 19:57:39 +07:00
spacewander f29dad042c git-pr: accpeted multiple GitHub URL or ID with remote. 2019-02-02 12:29:41 +08:00
spacewander 87b7c959b4 git-pr: added <[remote]:pr number> option. 2019-02-02 11:45:27 +08:00
罗泽轩 088ea058d9
Merge pull request #740 from spacewander/tweak_man_readme
doc: clarify the current working directory when building the docs.
2019-01-21 10:40:07 +08:00
spacewander c4db208ca4 doc: clarify the current working directory when building the docs. 2019-01-18 17:56:18 +08:00
罗泽轩 44dc1b9dba
Merge pull request #739 from sleagon/master
feat: Add -s(--soft) for git sync
2019-01-16 12:19:03 +08:00
单元源 9f806bb828 feat: Add -s(--soft) for git sync
feat: Add readme for man page and helper

fix: Remove git-sync.1.html
2019-01-16 11:38:35 +08:00
罗泽轩 49fab7267b
Merge pull request #738 from StuartFeldt/add-symlinks-to-bulk-command
Adding support for symlinked dirs in bulk command
2018-12-11 10:06:01 +08:00
Stu Feldt 3730339067 Adding support for symlink directories in bulk command 2018-12-10 11:07:49 -06:00
hemanth.hm a815bb0fbd
Merge pull request #737 from smancill/standup-ensure-colors
git-standup: ensure color usage
2018-11-21 10:12:37 +05:30
Sebastián Mancilla 13fa83b24e git-standup: ensure color usage
Git may fail to detect that the tty supports colors and fallbacks to
non-colored output.

This overrides that by specifying the color parameter.

Based on kamranahmedse/git-standup#84
2018-11-20 14:44:40 -03:00
罗泽轩 eb27b24b73
Merge pull request #736 from spacewander/git_force_clone_not_need_git_repo
git-force-clone: should not need git repo
2018-11-06 15:26:54 +08:00
spacewander 5f961fe8e3 misc: sort command list in alphabetical order 2018-11-03 12:36:25 +08:00
spacewander a5edb6d8b7 git-force-clone: should not need git repo 2018-11-03 10:12:00 +08:00
罗泽轩 7e10554506
Merge pull request #734 from zentarul/master
Fix missing double quotes after %DEBUG% in install.cmd
2018-11-02 10:04:09 +08:00
zentarul 700580aae6
Fix missing double quotes after %DEBUG% 2018-11-01 11:11:53 -04:00
spacewander 6e7766f5a4 install.cmd: tweak comments 2018-10-16 21:52:28 +08:00
罗泽轩 3b7637ce40
Merge pull request #732 from sachin-gupta/sg-mods
Fix: Dev: `/E` option required to install on Win 10 {b17134} or higher
2018-10-16 21:45:26 +08:00
Sachin Gupta edebba89b9 Fix: Dev: /E option required with MORE for working on higher version of Windows 10 (**_Build 17134_**)
Changes:
- Added small text line to debug files being written iff environment variable `%DEBUG%` is `true`
- Added option `/E` to both MORE commands used inside install.cmd for copying files.
2018-10-09 14:07:05 +05:30
罗泽轩 8b992cc9bc
Merge pull request #729 from orestisf1993/patch-1
git-rename-branch: Don't fail if remote doesn't exist
2018-09-13 22:29:07 +08:00
Orestis 7393fb41ed
git-rename-branch: Don't fail if remote doesn't exist
Allows the command to work correctly with local branches.

Closes #535
2018-09-13 15:15:03 +03:00
Peter Bittner b7d507567b Make git undo -s restore the staging area 2018-08-17 16:22:54 +02:00
spacewander 2590998ee0 Bump version to 4.7.0-dev. 2018-08-11 11:33:30 +08:00
spacewander 8545d97b8d Version 4.6.0 2018-08-11 09:57:41 +08:00
罗泽轩 424ec4d2a5
Merge pull request #727 from spacewander/strip_caret
git-changelog: should remove ^0 suffix from the commit description.
2018-08-10 00:00:58 +08:00
罗泽轩 1cb4979ed7
Makefile: change the installed manpage destination in FreeBSD (#725) 2018-08-09 10:06:18 +08:00
spacewander a347e49178 git-changelog: should remove ^0 suffix from the commit description. 2018-08-08 13:34:11 +08:00
罗泽轩 e4aaf9f697
Merge pull request #722 from spacewander/git_changelog_start_commit
git-changelog: add --start-commit option, like --start-tag but for commit
2018-06-20 15:41:51 +08:00
spacewander 792b697450 git-changelog: add --start-commit option, like --start-tag but for commit 2018-06-16 12:20:08 +08:00
罗泽轩 4e1cd73e59
Merge pull request #721 from spacewander/git_changelog_list_newline
git-changelog: add missing newline to the plain output
2018-06-16 10:04:02 +08:00
spacewander b7a1a0d8b2 git-changelog: add missing newline to the plain output
Previously, running "git changelog -x --start-tag 4.5.0 -p -l" will see

* Bump version to 4.6.0-dev.  * Version 4.5.0

Because there is no newline in the end of each plain output.
2018-06-15 18:14:18 +08:00
罗泽轩 d681b972cc
Merge pull request #713 from pabs3/docs
Updates to the documentation building workflow and docs
2018-05-30 13:49:18 +08:00
罗泽轩 28819e388e
Merge pull request #717 from flatcap/ignore-private
add: git-ignore -p (private to repo)
2018-05-25 19:34:47 +08:00
Richard Russon f30005acfd optimisation of mkdir 2018-05-25 11:16:14 +01:00
Richard Russon 691d640b2d Ensure info dir exists 2018-05-25 10:12:27 +01:00
Richard Russon 0f76863d9b add: git-ignore -p (private to repo) 2018-05-23 23:59:21 +01:00
罗泽轩 a4f85ae6ff
Merge pull request #716 from francoism90/patch-1
Add installation guide for Arch Linux
2018-05-21 11:35:20 +08:00
François M 787ee2c997
Added Arch Linux
Link to packages, since Arch Linux may use an AUR helper.
2018-05-20 14:31:47 +02:00
罗泽轩 d34b6ae0bc
Merge pull request #714 from spacewander/fix_detect_sed_i_support
git-sed: fix previous bsd sed workaround
2018-05-16 14:38:10 +08:00
Paul Wise f5c26c7fb3
Documentation rebuild: git-sed.* flags argument
Reflects changes in commit ee14220f66
2018-05-09 17:16:52 +08:00
Paul Wise 731e9d8db9
Documentation rebuild: git-clear.html whitespace removal
Reflects changes in commit a6732ef6db
2018-05-09 17:16:52 +08:00
Paul Wise 8b58e570cb
Documentation rebuild: git-extras.* updates
Re-orders git-clear/git-clear-soft and git-lock/git-locked due to
differences between the sorting by make and shell.
2018-05-09 17:16:52 +08:00
Paul Wise ba6d991851
Documentation rebuild: index.txt updates
Removes most index.txt whitespace because whitespace is insignificant in
ronn index.txt files and POSIX shell makes it hard to use the right amount.

Re-orders git-clear/git-clear-soft and git-lock/git-locked due to
differences between the sorting by make and shell.
2018-05-09 17:16:52 +08:00
Paul Wise bd6a1fcafe
Documentation rebuild: dates and headers
Adds "Git Extras" to all the headers.
Updates all the dates to the last modification.
2018-05-09 17:16:52 +08:00
Paul Wise 317e546b0a
Remove one of the documentation building tools
The two methods build slightly different manual pages.

The Makefile based version has better headers so use it.

Automatically generate git-extras.md and index.txt when building docs.
2018-05-09 17:16:49 +08:00
Paul Wise a6732ef6db
Remove some trailing whitespace 2018-05-09 10:20:46 +08:00
罗泽轩 3802e83e79
Merge pull request #715 from tjaartvdwalt/master
Fix bugs with git-release --semver
2018-05-08 10:27:42 +08:00
Tjaart van der Walt 658f133691 Major/Minor release should reset minor/patch versions to 0
There is a bug in the current version:

```
version=1.1.3
./git-release --semver minor
version=1.2.3
```

The correct behavior should be:

```
version=1.1.3
./git-release --semver minor
version=1.2.0
```
2018-05-07 15:00:39 -07:00
Tjaart van der Walt 6f416b20c3 Fix greedy match of version number
The original regex will greedily match the first digit of version
numbers that have multiple digits.
2018-05-07 14:44:35 -07:00
spacewander f7514bebbf git-sed: fix previous bsd sed workaround 2018-05-07 15:18:28 +08:00
罗泽轩 d024755718
Merge pull request #712 from spacewander/detect_sed_i_support
git-sed: detect sed -i support and work around for the BSD sed
2018-05-05 11:22:00 +08:00
spacewander 0ab9b47371 git-sed: detect sed -i support and work around for the BSD sed 2018-05-05 10:57:57 +08:00
罗泽轩 4325238aee
Merge pull request #709 from pabs3/git-sed
Improve the git-sed command
2018-05-03 17:30:06 +08:00
Paul Wise 9785199036
git-sed: discover a separator when the / character is used in arguments
Prevents sed from returning an error for arguments containing filenames:

$ git sed src/foo.c src/bar.c
sed: -e expression #1, char 13: unknown option to `s'
2018-04-26 11:07:07 +08:00
Paul Wise c27a3505dc
git-sed: pass the -r option to the xargs command
Prevents running sed when the search pattern does not match any files.

This results in sed printing an unnessecary warning:

$ git sed foo bar
sed: no input files
2018-04-26 11:06:34 +08:00
Paul Wise ee14220f66
git-sed: Allow the flags to be passed as a third argument
This is more in-line with how sed itself works.
2018-04-20 11:29:54 +08:00
罗泽轩 1b94ca130c
Merge pull request #706 from MontakOleg/delete-branch
Fix deleting branches without upstream
2018-03-25 14:16:53 +08:00
Montak Oleg fd2151f9bb Fix deleting branches without upstream 2018-03-25 00:10:59 +03:00
罗泽轩 6add6488d7
Merge pull request #704 from ramlev/master
Remove double path delimiters in zsh description
2018-03-22 17:06:41 +08:00
Hasse Ramlev Hansen 22a44eb206 Remove double path delimiters in zsh description 2018-03-22 06:56:36 +01:00
罗泽轩 420c678526
Merge pull request #703 from psprint/master
Installation.md: Zsh-plugin method which doesn't require root access
2018-03-02 16:05:55 +08:00
Sebastian Gniazdowski c53edf00da Installation.md: Zsh-plugin method which doesn't require root access 2018-03-01 16:39:59 +01:00
spacewander ebf7903d0e Bump version to 4.6.0-dev. 2018-02-18 18:58:16 +08:00
spacewander 4ab42e218e Version 4.5.0 2018-02-18 11:56:35 +08:00
spacewander e9ddc1dc3b git-release: show message if nothing given after --semver 2018-02-18 11:37:23 +08:00
spacewander f5d99bcac9 doc: update git-extras index 2018-02-15 22:57:56 +08:00
罗泽轩 9ee318e8d4
Merge pull request #639 from spacewander/avoid_deleting_local_upstream
git-delete-branch: avoid deleting local upstream
2018-02-15 12:23:29 +08:00
罗泽轩 5dbab48aff
Merge pull request #693 from xakraz/fix-mktemp-pattern
Fixed mktemp template to support busybox (and Alpine linux)
2018-02-11 20:26:23 +08:00
spacewander de364cfac1 git-release: add --no-empty-commit for empty commit hater 2018-02-11 20:12:10 +08:00
spacewander 8714ac4aa1 git-release: create an empty release commit if there is nothing to commit 2018-02-11 20:12:10 +08:00
罗泽轩 d4bf79df8f
git-summary: unescape tab for linux column utility
git-summary: unescape tab for linux column utility

Linux column utility will escape tab if a separator is specified.
This problem is first reported in Fedora 27.
2018-02-08 22:34:43 +08:00
spacewander 16591d3788 git-undo: add confirmation when -h is specified 2018-02-07 10:37:55 +08:00
Xavier Krantz 80e93704eb Fixed mktemp template to support busybox (and Alpine linux) 2018-02-05 12:33:18 +01:00
罗泽轩 8216e6bbbc
Merge pull request #691 from koppor/patch-1
Remove trailing dot of German Windows
2018-02-05 11:25:53 +08:00
Oliver Kopp f959b4d4d3
Remove trailing dot of German Windows 2018-02-04 13:04:25 +01:00
罗泽轩 db2d0456ac
Merge pull request #690 from dominicbarnes/release-push-tags-first
feat(git-release): push tags first to help ci tools not miss them
2018-01-25 10:32:50 +08:00
Dominic Barnes 5639160b8b feat(git-release): push tags first to help ci tools not miss them
If you are buliding on CircleCI for example, pushing the commits first
can lead to a race where CI env will not see the tags since the pull
happened before the tags were finished pushing.

It should be fully safe (and backwards-compatible) to change the order
of pushing to the remote.
2018-01-23 13:51:44 -08:00
罗泽轩 c2efbc889d
Merge pull request #687 from spacewander/add_semver
git-release: handle extra non-numeric prefix in tag with --semver
2017-12-14 18:40:41 +08:00
spacewander ab99fb3eb2 git-release: handle extra non-numeric prefix in tag with --semver 2017-12-12 10:10:37 +08:00
hemanth.hm 17fce79d3c
Merge pull request #686 from spacewander/add_semver
git-release: add --semver option
2017-12-10 12:34:05 +05:30
spacewander 693c84f8f0 git-release: add --semver option 2017-12-10 14:06:00 +08:00
hemanth.hm b7d960eadb
Merge pull request #684 from spacewander/ignore_unknown_arg
git-release: function usage doesn't exist, ignore unknown argument instead
2017-12-08 10:41:31 +05:30
spacewander 199364e932 git-release: function usage doesn't exist, ignore unknown argument instead 2017-12-07 00:29:07 +08:00
hemanth.hm 3b21b87036
Merge pull request #681 from EdwardBetts/master
Fix so 'git rebase-patch' is described once.
2017-11-26 12:57:30 +05:30
Edward Betts fc8eaf0d28 Fix so 'git rebase-patch' is described once. 2017-11-26 06:31:22 +00:00
罗泽轩 6aecc2b9fa
Merge pull request #680 from lhernanz/master
Preserve existing user commands in zsh completion
2017-11-15 15:12:08 +08:00
Luis Miguel Hernanz 43bc038d41 Preserve the existing user_commands in the git completion system 2017-11-14 22:57:50 -08:00
罗泽轩 82896c8553
Merge pull request #679 from spacewander/update_git_changelog_doc
Mention how to control changelog format in docs of git-changelog
2017-11-13 14:18:37 +08:00
罗泽轩 f1aeed4344
Merge pull request #678 from timhwang21/devs/thwang/docs-update
Docs> Add -- in front of cmd for git log
2017-11-10 19:58:36 +08:00
spacewander 46bc0959e1 Mention how to control changelog format in docs of git-changelog 2017-11-10 11:20:08 +08:00
Timothy Hwang 167f0c8b50 Docs> Add -- in front of cmd for git log
The current docs are incorrect, using the command gives an error msg:

```
error: unknown argument --since=1 week ago
error: if that argument was meant for git-log,
error: please put it after two dashes ( -- ).
```
2017-11-09 13:54:54 -05:00
罗泽轩 e7ca960f0c
Merge pull request #676 from gormac/master
Fix 'Invalid code page' error when restoring code page at end of script for Windows
2017-11-03 16:38:09 +08:00
Marco Glasbergen d520e0641e Fix 'Invalid code page' error when resetting code page at end of script 2017-11-03 09:00:51 +01:00
罗泽轩 9573a7653b Merge pull request #675 from quite/effort-cursor
git-effort: restore normal (visible) cursor properly
2017-10-27 20:18:47 +08:00
Daniel Lublin af39b2b2ee git-effort: restore normal (visible) cursor properly
If I understand GNU* correctly, cnorm should be used to undo `civis` (make
invisible). `cvvis` is just another abnormal mode, namely "very visible".

*) https://www.gnu.org/software/termutils/manual/termutils-2.0/html_chapter/tput_1.html
2017-10-27 10:30:17 +02:00
hemanth.hm 78835c7525 Merge pull request #674 from tj/pull-request-two-factor-auth
Add GitHub two factor auth support to git-pull-request
2017-10-22 06:02:55 +05:30
spacewander a88958ba20 Add GitHub two-factor auth support to git-pull-request 2017-10-18 10:47:17 +08:00
hemanth.hm 5b7c076fba Merge pull request #672 from mehandes/patch-1
Added Nix/NixOS method of installation
2017-10-15 15:41:52 +05:30
Matt 942bab3b32 Added Nix/NixOS method of installation 2017-10-15 11:23:25 +02:00
罗泽轩 7b76644bc6 Merge pull request #671 from sambostock/improve-ignore-io
Improve ignore-io
2017-10-15 10:37:39 +08:00
Sam Bostock 6b5f5d8762 Use local variables & format strings 2017-10-14 13:31:31 -04:00
Sam Bostock 18d8221dd2 Fix omission when alphabetically printing ignores
Iterating through `a..z` omits entries starting with other characters.
2017-10-09 23:18:18 -04:00
Sam Bostock cfcb4d92c6 Remove arbitrary column limit on ignore-io 2017-10-09 23:08:12 -04:00
罗泽轩 1f0a044677 Merge pull request #670 from zeeshanu/patch-1
Fix typo in Commands.md
2017-08-09 20:51:19 +08:00
Zeeshan Ahmed 9f621306cb Fix typo 2017-08-09 11:23:19 +05:00
hemanth.hm c59ddb73b4 Merge pull request #668 from isaacm/patch-1
Fix typos
2017-07-19 22:30:22 +05:30
Isaac Mungai 669c9180b4 Fix typos, remove trailing whitespace 2017-07-19 10:18:01 -04:00
spacewander 12cd938db3 install: submit brew patch to upstream
Follow the atempt of pull request #491
2017-07-16 16:50:55 +08:00
spacewander 4defd6d676 Bump version to 4.5.0-dev. 2017-07-16 12:37:58 +08:00
spacewander be8a1548d4 Version 4.4.0 2017-07-15 16:25:54 +08:00
spacewander 15759061f5 install: display absolute path of zsh completion script 2017-07-15 14:37:24 +08:00
spacewander 423c49ab92 zsh: update completion of git bug|chore|feature|refactor|create-branch 2017-07-15 11:41:17 +08:00
spacewander 227ef26e7f git summary: use more common way to cd to top level directory 2017-07-15 09:57:57 +08:00
罗泽轩 9e2a625b29 Merge pull request #664 from mapitman/master
Specify upstream for git bug/chore/feature/refactor and git create-branch won't set origin as upstream by default
2017-07-13 12:25:18 +08:00
Mark Pitman d990270de7 Update man page for create-branch
Add notes section to talk about change in default behavior.
2017-07-12 20:07:25 -07:00
Mark Pitman 4dc76ef81b Update man pages 2017-07-12 00:59:56 -07:00
Mark Pitman ab6c51bb8f Update docs for new behavior
`git create branch`
`git feature|bug|chore|refactor`
2017-07-12 00:14:24 -07:00
Mark Pitman c064956f85 Use "$@" instead of $@ 2017-07-11 23:37:16 -07:00
Mark Pitman a75411b029 Consolidate feature/bug/chore/refactor logic
Remove unneccesary code
2017-07-11 21:42:02 -07:00
Mark Pitman 93150aa411 Allow -r parameter to be in any order in command line 2017-07-11 21:41:06 -07:00
Mark Pitman 61b2a2c703 Add ability to specify a remote
Use -r to push the new branch to origin
Use -r <remote_name> to push to <remote_name>

Will not auto push to origin if you do not use the argument
2017-07-09 01:57:46 -07:00
Mark Pitman be15db9cdf Fix Issue #186
Use `git create-branch` instead of `git checkout -b` in:
git-bug
git-chore
git-feature
git-refactor

Since `git-finish` uses `git-delete-branch` (which expects the branch to
have been pushed to origin) we should use `git-create-branch` to create
it.
2017-07-07 23:19:02 -07:00
spacewander 6bd1ebd68b fix a wrong name in installation message 2017-07-06 16:06:29 +08:00
罗泽轩 9a6c60e6a7 Merge pull request #662 from nschlimm/master
Added git-bulk to not_need_git_repo
2017-06-20 19:07:08 +08:00
Niklas Schlimm acb3f93ae4 Added git-bulk to not_need_git_repo 2017-06-20 12:11:48 +02:00
spacewander 4d885acda0 fix various typos 2017-06-18 20:22:11 +08:00
罗泽轩 ce6d635c33 Merge pull request #659 from bersace/mr
Add git-mr to checkout GitLab merge requests
2017-06-16 17:46:02 +08:00
Étienne BERSAC d4c7581835
Add git-mr to checkout GitLab merge requests 2017-06-16 11:11:50 +02:00
罗泽轩 4b29351f2f Merge pull request #656 from dueringa/patch-1
Fix typo in git-extras
2017-05-16 22:27:58 +08:00
Andreas Duering 9baae93a9b Fix typo in git-extras
Output said "Setting up 'git-exras" instead of "Setting up 'git-extras"
2017-05-16 15:12:45 +02:00
hemanth.hm 9334c9db31 Merge pull request #654 from spacewander/replace-xargs-r
git-delete-merged-branches: replace xargs -r option
2017-05-09 14:49:55 +05:30
spacewander 0e7cba55a8 git-delete-merged-branches: replace xargs -r option 2017-05-09 10:48:45 +08:00
spacewander 276a307780 Bump version to 4.4.0-dev. 2017-05-06 14:45:15 +08:00
spacewander 88ee400c3f Version 4.3.0 2017-05-05 16:50:41 +08:00
spacewander f55690e702 git-authors: remove trailing spaces 2017-05-05 16:02:09 +08:00
罗泽轩 204406bd29 Merge pull request #649 from adriaanzon/patch-1
git-fork: Let curl exit with error code on fail
2017-05-05 16:00:39 +08:00
罗泽轩 0bae07f7b9 Merge pull request #651 from spacewander/pass-arguments-to-hooks
pass tag and optional arguments to hook and stop if pre-release hook fails
2017-05-03 22:33:51 +08:00
spacewander 27310926d3 git-release: add pre-release failure message 2017-05-03 09:54:17 +08:00
spacewander 3428b278d3 git release: stop if pre-release hook fails 2017-05-02 14:59:18 +08:00
spacewander d01ad47953 git-release: update docs 2017-05-02 14:53:36 +08:00
Daniel Bruder b41a4cf05b pass release arguments to pre/post-release scripts
With some modification to catch up with latest situation.
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2017-05-02 14:35:03 +08:00
Adriaan Zonnenberg bd8545f748 git-fork: Let curl exit with error code on fail 2017-04-27 18:44:20 +02:00
罗泽轩 4917796d63 Merge pull request #647 from SMillerDev/patch-1
Add BSD cat support
2017-04-24 10:04:11 +08:00
Sean Molenaar 14159245a9 Add BSD cat support
on macOS cat doesn't support the long operator
2017-04-21 15:37:48 +02:00
hemanth.hm 5cdfe42113 Merge pull request #646 from spacewander/upgrade-git-standup
Upgrade git-standup to new interface
2017-04-13 22:17:35 +05:30
spacewander 383f95f7c8 git-standup: update zsh completion 2017-04-13 00:16:55 +08:00
spacewander 0a125edeaf git-standup: also update the docs 2017-04-13 00:16:37 +08:00
spacewander 684d6acc93 git-standup: add sanity check to -d option and overwrite -w option 2017-04-12 23:39:58 +08:00
spacewander 0b91cd9bae git-standup: upgrade interface to catch up with kamranahmedse/git-standup 2017-04-12 14:17:25 +08:00
罗泽轩 61211634c9 Merge pull request #642 from nschlimm/git-bulk-command
Git bulk command
2017-04-01 10:40:08 +08:00
Niklas Schlimm 759b3841b8 Typos again 2017-03-31 18:20:12 +02:00
Niklas Schlimm fe39ac8af2 Corrected repository location print out and docs ws-root-directory absolute path 2017-03-30 19:31:32 +02:00
Niklas Schlimm ca62bdcfe6 Codereview Spacewander - whitespaces in workspace locations 2017-03-29 17:34:39 +02:00
罗泽轩 fda5f3e4ef Merge pull request #643 from jonyamo/git-pr_clean-git-config
Remove slashes from git-config command
2017-03-29 12:16:11 +08:00
Niklas Schlimm 7263b6c611 Review from spacewander 2017-03-28 21:52:21 +02:00
J.C. Yamokoski 6eb04bcca8 Remove slashes from git-config command
These slashes were causing the branch to be saved in `.git/config` with headings
such as `[branch "\"pr/123\""]` as opposed to `[branch "pr/123"]`. This in turn
prevented these entries from being removed when running `git pr clean`.
2017-03-28 09:44:40 -04:00
Niklas Schlimm de15bf7fb0 Merge branch 'master' into git-bulk-command 2017-03-19 19:49:08 +01:00
罗泽轩 49771ba018 Merge pull request #636 from spacewander/fix_rename_branch
use remote detected instead of 'origin' in rename-branch
2017-03-19 20:52:48 +08:00
hemanth.hm 6e9da2a4e7 Merge pull request #641 from tj/fix_pull_request_upstream
pull_request: should use detected upstream instead of hardcore origin
2017-03-19 12:57:32 +05:30
spacewander 4a05ad29e4 git-rename-branch: use detected upstream remote 2017-03-19 02:00:11 +08:00
spacewander 344b145062 git-pull-request: use detected upstream remote 2017-03-19 01:31:44 +08:00
spacewander 9744830d4a git-delete-branch: avoid deleting local upstream 2017-03-18 22:13:57 +08:00
Niklas Schlimm 02dc8b5b21 Better behaviour in non workspace directories 2017-03-17 17:33:53 +01:00
Niklas Schlimm d3cccebbd2 Current workspace is default target of bulk operations 2017-03-17 17:13:15 +01:00
Niklas Schlimm 9260fd92bf Even shorter 2017-03-13 21:06:50 +01:00
Niklas Schlimm 5957544dee Code refactor 2017-03-12 16:15:09 +01:00
Niklas Schlimm 9263aec739 bug fix in single ws mode 2017-03-08 20:26:44 +01:00
Niklas Schlimm 1cc77481bd code formatting 2017-03-08 20:11:26 +01:00
Niklas Schlimm 534c72b91f Fix in git-bulk head 2017-03-08 19:58:34 +01:00
Niklas Schlimm 57c0eb776c New Command git-bulk initial commit 2017-03-08 19:50:36 +01:00
hemanth.hm b00aacee00 Merge pull request #635 from spacewander/fix_rename_branch
fix syntax & name variables better in rename-branch
2017-03-07 14:18:02 +05:30
spacewander cc0dff2f49 fix syntax & name variables better in rename-branch 2017-03-07 14:39:50 +08:00
罗泽轩 b0ba3e5346 Merge pull request #633 from nschlimm/columnsflex
Columns in git-effort adopt to file length
2017-03-06 11:51:26 +08:00
Niklas Schlimm 422c9a8e69 taken out duplicate columns setting 2017-03-05 16:06:47 +01:00
Niklas Schlimm b01359efc5 Optimized file length calculation 2017-03-04 14:21:26 +01:00
Niklas Schlimm 518db6e648 Columns in git-effort adopt to file length 2017-03-04 13:59:48 +01:00
hemanth.hm 2289c25029 Merge pull request #630 from jjlin/rhel/centos
Add RHEL/CentOS installation
2017-02-18 13:14:40 +05:30
Jeremy Lin 719dd2c3af Add RHEL/CentOS installation 2017-02-17 11:15:24 -08:00
hemanth.hm 28363eff4e Merge pull request #629 from dankilman/fix-git-effort
Fix git-effort for paths starting with dash
2017-02-15 09:07:22 +05:30
Dan Kilman b2c7de9a5a Fix git-effort for paths starting with dash 2017-02-14 23:57:19 +02:00
罗泽轩 9c1feecca5 Merge pull request #626 from jldugger/jldugger/email-fallback
fall back to EMAIL when user.email is not configured
2017-02-03 10:38:28 +08:00
Justin Dugger c80b4e773f fall back to EMAIL when user.email is not configured 2017-02-01 20:36:34 -08:00
Nicolai Skogheim e93f206bad Merge pull request #619 from spacewander/git-summary-separator
use U+266A instead of comma as separator
2017-01-31 11:32:56 +01:00
hemanth.hm 484b98bb04 Merge pull request #624 from spacewander/has_git_commit
Check commit existed before running some commands
2017-01-27 16:53:47 +05:30
spacewander 64b4a599e8 Check commit existed before running some commands 2017-01-27 18:58:16 +08:00
罗泽轩 c258e5d4e8 Merge pull request #615 from techjacker/master
Adds 2FA support to git-fork
2017-01-27 10:45:10 +08:00
Andrew Griffiths 2451c0c202 Adds SSH prompt to git fork 2017-01-25 10:32:49 +00:00
spacewander bb5f4b0234 use U+266A instead of comma as separator 2017-01-24 14:13:38 +08:00
罗泽轩 2e8b368141 Merge pull request #610 from nicolaiskogheim/fix-spelling
spelling: {a,an} archive
2016-12-26 19:57:49 -06:00
Nicolai Skogheim e31f61ba34 spelling: {a,an} archive. Fix #609 2016-12-26 19:22:55 +01:00
hemanth.hm df06f9af2e Merge pull request #606 from spacewander/fix-git-extras-update
fix git-extras update and tweak Windows detection
2016-12-07 09:45:30 +05:30
spacewander b8ea5c4a02 fix git-extras update and tweak Windows detection
Replace expr with bash substring expansion.
Tested under:
GNU bash, version 4.3.42(5)-release (x86_64-pc-msys)
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin16)
2016-12-07 10:39:53 +08:00
罗泽轩 82162ea8c8 Merge pull request #585 from tardypad/stamp
Add git stamp
2016-12-05 20:13:50 +08:00
罗泽轩 15ae263312 Merge pull request #578 from tardypad/count_fix_extra_arguments
count: remove usage of extra arguments for detailed display
2016-12-05 09:49:03 +08:00
Damien Tardy-Panis c5bd28dd51 stamp: show real looking results in Commands.md doc 2016-12-04 16:21:09 +01:00
Damien Tardy-Panis a7779a1029 stamp: add warning in documentation about corner case 2016-12-04 16:21:09 +01:00
Damien Tardy-Panis 9ea8f98e5c stamp: add zsh autocompletion 2016-12-04 16:21:09 +01:00
Damien Tardy-Panis a118f306b1 stamp: remove non used multiple lines error messages 2016-12-04 16:21:09 +01:00
Damien Tardy-Panis 4aec48c85c stamp: the message consists in all terms after the identifier
no need to put quotes in case of spaces
2016-12-04 16:21:09 +01:00
Damien Tardy-Panis c9463bf6ef stamp: identifier is case insensitive for the replacement 2016-12-04 16:21:09 +01:00
Damien Tardy-Panis 705bb32a7a stamp: add to Commands doc 2016-12-04 16:21:05 +01:00
Damien Tardy-Panis 3b621f1052 stamp: add manual 2016-12-04 16:18:54 +01:00
Damien Tardy-Panis 13f15d5339 stamp: add bash autocompletion 2016-12-04 16:18:54 +01:00
Damien Tardy-Panis b105dd837a stamp: add replace option
replace all previous stamps with same identifier in commit message
2016-12-04 16:18:54 +01:00
Damien Tardy-Panis 3ffbe23fbe stamp: display new full message as result 2016-12-04 16:18:54 +01:00
Damien Tardy-Panis 79629e6b6e stamp: add extra optional message parameter 2016-12-04 16:18:54 +01:00
Damien Tardy-Panis cd328bfb61 stamp: add basic script 2016-12-04 16:18:54 +01:00
罗泽轩 76694bccdd Merge pull request #601 from richardfearn/git-sed-spaces-in-filenames
git-sed: use "grep -z" and "xargs -0" to cope with spaces in filenames
2016-11-20 10:38:46 +08:00
hemanth.hm 29a5596d9e Merge pull request #603 from richardfearn/git-clear-consistent-defaults
git-clear-soft: change default yes/no option to "no" (as with git-clear)
2016-11-20 05:16:22 +05:30
hemanth.hm 20a9e95b9a Merge pull request #602 from richardfearn/git-delete-merged-branches-fix
git-delete-merged-branches: use "xargs -r" to prevent error when there are no branches to delete
2016-11-20 05:15:58 +05:30
Richard Fearn c4a9bb46d9 git-clear-soft: change default yes/no option to "no" (as with git-clear)
6d49449 changed the git-clear default option to "no" (see #583).

Make the git-clear-soft default the same - it's safer.
2016-11-19 17:53:51 +00:00
Richard Fearn 8cbbf9095a git-delete-merged-branches: use "xargs -r" to prevent error when there are no branches to delete
Prevents this error:

    $ git delete-merged-branches
    fatal: branch name required
2016-11-19 17:41:30 +00:00
Richard Fearn 2292e1cebe git-sed: use "git grep -z" and "xargs -0" to cope with spaces in filenames
Otherwise filenames with spaces result in errors:

    $ cat "file with spaces in name"
    old

    $ git sed old new
    sed: can't read file: No such file or directory
    sed: can't read with: No such file or directory
    sed: can't read spaces: No such file or directory
    sed: can't read in: No such file or directory
    sed: can't read name: No such file or directory
2016-11-19 17:26:17 +00:00
罗泽轩 fd2de52949 Merge pull request #600 from richardfearn/git-fresh-branch-fix
git-fresh-branch: fix handling of 'yes' response when there are changes
2016-11-20 01:25:30 +08:00
罗泽轩 7f14cc4488 Merge pull request #599 from richardfearn/improve-yes-no-prompts
git-{clear,clear-soft,sync}: improve yes/no prompts
2016-11-20 01:17:18 +08:00
Richard Fearn 4f8e411f71 git-fresh-branch: fix handling of 'yes' response when there are changes
'break' isn't valid in its current location in the script, resulting in an
error like:

  /usr/bin/git-fresh-branch: line 42: break: only meaningful in a `for', `while', or `until' loop

Since there's a call to 'clean' right at the end of the script, do nothing if
anything beginning 'Y' or 'y' is entered; execution will continue to the end
of the script, and 'clean' will be called.
2016-11-19 16:59:58 +00:00
Richard Fearn 82d6a7265f git-{clear,clear-soft,sync}: improve yes/no prompts
Don't print trailing newline; prompt for yes/no response on the same line
2016-11-19 16:41:19 +00:00
hemanth.hm 1ed75978a9 Merge pull request #598 from richardfearn/fix-git-sed-typo
git-sed: fix 'unkonwn' typo
2016-11-19 20:52:43 +05:30
罗泽轩 54de081be7 Merge pull request #597 from richardfearn/commands-md-improvements
Improvements to Commands.md
2016-11-19 22:20:02 +08:00
Richard Fearn 009f4fb6d1 git-sed: fix 'unkonwn' typo 2016-11-19 14:03:21 +00:00
Richard Fearn 575f5dfd19 Commands.md: add link to 'git summary' in 'git line-summary' documentation 2016-11-19 13:41:21 +00:00
Richard Fearn 2a70117f02 Commands.md: add links to "git bug", etc. to index
Replace single "git feature|refactor|bug|chore" link with separate links for
each of the four commands, so they all appear in the right place in the index.
2016-11-19 13:36:48 +00:00
Richard Fearn c5d29821da Commands.md: add 'git rscp' link to 'git scp' documentation
(git scp documentation also covers git rscp)
2016-11-19 13:33:39 +00:00
Richard Fearn 4d92c8bdbf Commands.md: put commands in alphabetical order 2016-11-19 13:29:00 +00:00
hemanth.hm 9f48c6a1cc Merge pull request #596 from richardfearn/archive-file-typo-fix
Fix typo in archive-file documentation
2016-11-18 20:29:20 +05:30
Richard Fearn c3a303ef70 Fix typo in archive-file documentation 2016-11-18 12:26:11 +00:00
罗泽轩 e1f0f6937a Merge pull request #595 from aaguilera/master
fix: git-squash docs. Replaced 'actual' with 'current'
2016-11-18 10:18:38 +08:00
Angel Aguilera 77e55640d7 fix: git-squash docs. Replaced 'actual' with 'current' 2016-11-14 11:17:28 +01:00
hemanth.hm ec64fe6500 Merge pull request #592 from spacewander/fix_integrity
Fix integrity for git-reauthor
2016-11-12 20:45:45 -08:00
spacewander 7aa7bcf740 Add travis ci 2016-11-12 15:03:10 +08:00
hemanth.hm 2d6e4eaf8a Merge pull request #594 from spacewander/fix_release
Show all commit messages if no tag found
2016-11-05 22:55:06 +05:30
spacewander b89c12e79b show all commit messages if no tag found 2016-11-05 14:33:16 +08:00
spacewander e101d825a2 strip out branches like trap-effort-signals 2016-11-05 12:10:03 +08:00
spacewander dead6873db Add git-reauthor to completion script 2016-11-01 10:24:12 +08:00
spacewander c8142ca539 Relax #! format check 2016-11-01 10:22:45 +08:00
罗泽轩 db62a6d95c Merge pull request #591 from nottrobin/force-clone
git-force-clone
2016-10-31 09:52:38 +08:00
Robin Winslow 71a12810e0 Be explicit about only resetting git directories
This expects a target git directory. If it's not a git directory,
(e.g. a simple directory) then it will pass through to
`git clone` which will raise an error.

Here I'm clarifying that this tool will reset local *git directories* specifically.
2016-10-29 17:24:18 +01:00
Robin Winslow 5550cfa4dc Fix branch option parsing
Needs an extra `shift`, to remove the second option as well.
2016-10-29 16:23:28 +01:00
Robin Winslow 6e87dc3e55 Fix usage 2016-10-29 16:18:09 +01:00
Robin Winslow 2137124977 Use LC_ALL=C for locale consistency 2016-10-29 16:16:18 +01:00
Robin Winslow ad5365fb53 Remove unnecessary check 2016-10-29 16:16:04 +01:00
Robin Winslow e476562a46 git-force-clone
All files for git-force-clone, a command for overwriting local repos when closing repositories.
2016-10-28 22:23:47 +01:00
罗泽轩 779f467612 Merge pull request #590 from bbbco/changelog-tmp-file-fix
Be sure to remove tempfile in git-changelog
2016-10-22 11:40:46 +08:00
Brian Goad 7ff05f2977 Need to remove the temp file regardless 2016-10-21 14:05:44 -04:00
hemanth.hm 249a6cd27c Merge pull request #589 from yelinaung/yla/typo-fixes
Spelling fixes
2016-10-15 22:11:06 +05:30
Ye Lin Aung f0a8b9e17e Spelling fixes for the roon file and html files 2016-10-15 22:46:04 +08:00
Ye Lin Aung 3ae8d22637 Spelling fixes
Fixed some spellings under man
2016-10-15 22:22:21 +08:00
hemanth.hm 39b9624381 Merge pull request #588 from spacewander/no-email
Add --no-email to git-author
2016-10-12 12:19:00 +05:30
spacewander 1b84048bfc Add --no-email to git-author
This feature is used to generate AUTHORS in 4.2.0 release.
2016-10-12 14:37:45 +08:00
spacewander 805d43831f Bump version to 4.3.0-dev. 2016-10-08 14:04:14 +08:00
spacewander 91aa82b62b Version 4.2.0 2016-10-08 13:52:34 +08:00
spacewander b649730a2c remove contributors' email addresses to avoid #544 2016-10-08 11:54:38 +08:00
spacewander f011c7656a promote two maintainers 2016-10-08 11:53:06 +08:00
罗泽轩 5c11295852 Merge pull request #584 from grindhold/fix-583
fixes #583
2016-09-24 11:06:15 +08:00
grindhold 6d49449a4d fixes #583
put default option in security-answer to 'no'
2016-09-23 22:38:27 +02:00
罗泽轩 8e15d4245d update docs to clarify rename-branch (#581) 2016-09-20 20:47:34 +05:30
Damien Tardy-Panis fae4c29870 count: remove usage of extra arguments for detailed display
When viewing detailed count information through the usage of the
--all argument, extra arguments would be also passed to the
git shortlog command (probably to be used as revisions list)
This behaviour was introduced in commit 7a60cd1.

Unfortunately the --all argument itself is passed along and results
in the counts of all refs to be displayed
This commit removed the usage of extra arguments and thus only
display the counts of the current branch
2016-09-12 13:46:25 +02:00
R. Martinho Fernandes 241069ddac Make git-pr set up branch for pulling (#570)
With these changes, the pr/nn branches created by git-pr also support `git pull` to get PR updates.
2016-09-11 09:12:41 +05:30
Hozefa 93c2830ce7 add link to ronn git repo (#575) 2016-09-11 09:11:49 +05:30
Hozefa 5a8ce5e364 add rename-branch command (#576) 2016-09-11 09:11:32 +05:30
罗泽轩 9d941e15e5 Merge pull request #569 from nicolaiskogheim/docs/repl-cleanup
git-repl: improve and clean up docs
2016-08-13 09:45:29 +08:00
Nicolai Skogheim 3efe6ab2df git-repl: improve and clean up docs 2016-08-12 15:57:26 +02:00
Nimit Kalra a319b6f25e Merge pull request #568 from wcmonty/master
Add built in 'exit' command to git-repl
2016-08-12 08:29:04 -05:00
William Montgomery d6f505f85a Add 'exit' to git-repl command documentation 2016-08-12 08:21:31 -04:00
William Montgomery 554d779344 Add built in 'exit' command to git-repl 2016-08-11 15:45:51 -04:00
罗泽轩 fb3bc8d7ae Merge pull request #567 from nicolaiskogheim/git-pull-request-fix#546
pull-request: should read local config if present
2016-08-07 17:08:12 +08:00
Nicolai Skogheim ebe7448e67 pull-request: should read local config if present 2016-08-07 09:43:07 +02:00
Nimit Kalra 3aafbc68c1 Merge pull request #566 from nfischer/fix-man-page-typo
git-release: fix typo in documentation
2016-08-06 19:42:41 -05:00
Nate Fischer 8dbc34a6a7 git-release: fix typo in documentation 2016-08-06 17:39:31 -07:00
Nicolai Skogheim e62a6584ca Merge pull request #565 from nicolaiskogheim/git-missing-argument-parsing
git-missing: do proper argument parsing. Fix #562
2016-08-06 20:34:09 +02:00
Nicolai Skogheim 20b84f5b17 git-missing: do proper argument parsing. Fix #562 2016-08-06 03:04:01 +02:00
Nicolai Skogheim 5d15928e82 Merge pull request #563 from lukechilds/improve-fork
git-fork: use ssh remotes if possible
2016-08-04 14:13:55 +02:00
Luke Childs 93ae8fd81e Update git-fork man page 2016-08-04 12:52:19 +01:00
Nicolai Skogheim dcf94a3323 Merge pull request #564 from sorbits/patch-3
Remove a non-contributor from AUTHORS
2016-08-03 19:59:26 +02:00
Allan Odgaard ce7cca1281 Remove a non-contributor from AUTHORS 2016-08-03 17:55:46 +02:00
Luke Childs ca78ac71ba Update docs to reflect new git-fork behaviour 2016-08-03 13:10:18 +01:00
Luke Childs c87d59346b Set fork remotes using ssh if available 2016-08-03 13:06:56 +01:00
Damien Tardy-Panis 9b3e25f407 Add git reauthor (#548)
Based on https://help.github.com/articles/changing-author-info/
2016-08-02 19:41:56 +02:00
Nicolai Skogheim f3954e1974 Merge pull request #555 from spacewander/contributing
Add Contributing guideline
2016-07-31 14:04:17 +02:00
罗泽轩 d38d3f4ffa modify CONTRIBUTING.md again 2016-07-30 22:49:06 +08:00
罗泽轩 5bceec4c16 Merge pull request #557 from spacewander/check_integrity
Add check integrity script
2016-07-30 22:48:22 +08:00
hemanth.hm 76f23c213d Merge pull request #561 from lukechilds/improve-json-encoding
Improve JSON encoding
2016-07-30 15:11:30 +05:30
Luke Childs 82b6eb4331 Clean up git-pull-request 2016-07-30 10:36:14 +01:00
Luke Childs a3c03d021e Improve JSON encoding 2016-07-30 00:50:39 +01:00
Nimit Kalra c1ac836c7f Merge pull request #560 from lukechilds/patch-2
Fix incorrect comment in git-fork
2016-07-29 18:21:07 -05:00
Nimit Kalra 855053dcee Merge pull request #559 from lukechilds/patch-1
Fix typo in Installation.md
2016-07-29 18:20:27 -05:00
Luke Childs 27e992b260 Fix incorrect comment in git-fork 2016-07-29 23:55:20 +01:00
Luke Childs e18ee20d18 Fix typo in Installation.md 2016-07-29 23:49:32 +01:00
hemanth.hm 77036074ef Merge pull request #558 from spacewander/fix_legacy_problem
Fix legacy problem
2016-07-29 10:21:42 +05:30
spacewander 66560432ce add doc for git-pull-request and others 2016-07-29 11:39:39 +08:00
spacewander 311ef28b66 modify CONTRIBUTING.md 2016-07-29 11:33:55 +08:00
spacewander 5384091183 update check_integrity with nicolaiskogheim's patch 2016-07-29 11:26:03 +08:00
spacewander a062420224 add git-release-patch to Commands.md 2016-07-28 22:24:40 +08:00
spacewander 88902b7586 add git-back to Commands.md 2016-07-28 22:24:40 +08:00
spacewander 3ff05a6f53 regenerate git-obliterate doc 2016-07-28 22:24:40 +08:00
spacewander b33f85a5d1 follow common shebang 2016-07-28 22:24:40 +08:00
spacewander c783733e16 add git-show-(un)merged-branches to Commands.md 2016-07-28 22:24:30 +08:00
spacewander f60f127d57 Add check integrity script 2016-07-28 22:18:27 +08:00
spacewander 3de481706d Add contributing guideline 2016-07-28 00:13:24 +08:00
hemanth.hm 0c8abf8624 Merge pull request #554 from npcode/fork-origin
Improve forking `origin` repo
2016-07-26 11:09:09 +05:30
Yi EungJun dbf87bf94e fork: Fetch origin after forking 2016-07-26 11:17:30 +09:00
Yi EungJun 362e08a2b6 fork: Quote refs by backtick rather than single quote
Follow what git does for the man pages[1].

[1]: 1249d8ad1c
2016-07-26 11:17:30 +09:00
Yi EungJun 90ea286a50 fork: Add git-fork.html removed by accident 2016-07-26 10:08:50 +09:00
hemanth.hm 1ec4835946 Merge pull request #553 from npcode/fork-origin
fork: Rename 'origin' to 'upstream' after forking
2016-07-25 22:32:14 +05:30
Yi EungJun c9729611e4 fork: Describe the behavior if current dir is repo 2016-07-26 01:35:52 +09:00
Yi EungJun 6e65f37392 fork: Rename 'origin' to 'upstream' after forking 2016-07-26 01:22:30 +09:00
hemanth.hm 859bf38c67 Merge pull request #552 from npcode/fork-origin
fork: Fork 'origin' remote repo if repo is not given
2016-07-25 21:04:01 +05:30
Yi EungJun 76663c26db fork: Fork 'origin' remote repo if repo is not given 2016-07-26 00:01:06 +09:00
hemanth.hm a1c5742a70 Merge pull request #551 from spacewander/zsh-completion
submit zsh completion script
2016-07-22 08:41:57 +05:30
spacewander 299efd84af submit zsh completion script to upstream
Now what you need is just `source /path/to/git-extras-completion.zsh`
2016-07-21 23:48:06 +08:00
spacewander 61c197bdbd update the title of git-clear-soft 2016-07-21 22:57:34 +08:00
hemanth.hm 217f536606 Merge pull request #550 from phuu/patch-1
Add note about overwriting git aliases
2016-07-19 21:55:11 +05:30
Tom Ashworth e2305d4501 Add note about overwriting git aliases 2016-07-19 16:43:27 +01:00
hemanth.hm f50447e6bd Merge pull request #547 from svanburen/patch-1
Fix typo
2016-07-12 23:22:38 +05:30
Stefan VanBuren fece2a517a Fix typo 2016-07-12 13:23:03 -04:00
hemanth.hm eb046dcdb3 Merge pull request #545 from spacewander/via_ssh
fix git-fork by removing '.git'
2016-06-27 18:51:29 +05:30
spacewander 09bbb56a39 fix git-fork by removing '.git' 2016-06-27 19:43:07 +08:00
hemanth.hm 381a0ff1fb Merge pull request #543 from spacewander/via_ssh
fix the support for forking via ssh
2016-06-27 12:28:28 +05:30
spacewander 34f5245672 fix the support for forking via ssh 2016-06-27 14:00:37 +08:00
hemanth.hm 1f374d1ea9 Merge pull request #412 from spacewander/git-obliterate
update git obliterate
2016-06-02 05:56:08 +05:30
hemanth.hm 1aadd1c52f Merge pull request #536 from spacewander/delete_submodule
Update the way to delete submodule
2016-06-01 20:06:49 +05:30
hemanth.hm becb14ad01 Merge pull request #537 from vigilancer/master
update documentation. fix "git ignore-io" flags
2016-05-25 14:22:02 +05:30
Andrey Elizarov 3c16905754 update documentation. fix "git ignore-io" flags 2016-05-25 07:01:10 +04:00
spacewander a39c89e34e Update the way to delete submodule 2016-05-17 17:20:03 +08:00
hemanth.hm b485aabea0 Merge pull request #533 from Addvilz/add-git-clear-soft-modify-git-clear
Add git clear-soft, modify git clear to indicate explicit removal of files
2016-05-02 19:38:30 +05:30
Matiss 3783a27a39 Edit description of git clear-soft to indicate hard reset 2016-05-01 19:10:54 +02:00
Matiss 61fee79cc7 Add git-clear-soft command
Modify git-clear to indicate default behavior of removing git ignored files
2016-05-01 19:05:21 +02:00
hemanth.hm e7826a717c Merge pull request #513 from lgastako/master
Add -m flag to git-setup to set the initial commit message.
2016-04-20 21:45:36 +05:30
hemanth.hm b865a2bae5 Merge pull request #525 from spacewander/git-standup
add git standup
2016-04-19 12:49:45 +05:30
hemanth.hm 24439aac6d Merge pull request #526 from carrodher/patch-1
Add Ubuntu installation
2016-04-19 12:49:17 +05:30
Carlos Rodríguez b8418cfba5 Add Ubuntu installation 2016-04-18 18:31:13 +02:00
spacewander 98f85c90b0 add docs for git standup 2016-04-15 20:34:03 +08:00
spacewander c43d4f2539 add git-standup 2016-04-14 15:40:11 +08:00
Nimit Kalra e91343e376 Merge pull request #519 from ifdattic/patch-1
Fix typo: typess => types
2016-03-19 13:25:26 -05:00
Andrew Marcinkevičius 301b436220 Fix typo: typess => types 2016-03-19 19:53:06 +02:00
hemanth.hm ddb097d65d Merge pull request #515 from ammarnajjar/fedora-install
Add Fedora package-manager installation instruction
2016-03-07 18:25:03 +05:30
Ammar Najjar 9090d3bbe9 Add Fedora package-manager installation instruction 2016-03-06 13:30:08 +01:00
John Evans 555282985d Add -m flag to git-setup to set the initial commit message. 2016-03-03 01:12:19 -05:00
hemanth.hm 71cf48b0c1 Merge pull request #512 from Lee-W/master
Fix ignore-io searching bug
2016-02-16 09:50:39 +05:30
Lee Wei 56a2e27910 Merge pull request #1 from tj/master
Update with the upstream
2016-02-16 11:30:22 +08:00
LeeW 3603b67eb7 Fix ignore-io searching bug 2016-02-16 11:17:04 +08:00
hemanth.hm ac0b5fe5ed Merge pull request #508 from pra85/patch-1
Mention initial copyright year and add contributors to copyright
2016-01-30 18:05:26 +05:30
Prayag Verma d286839da1 Mention initial copyright year and add contributors to copyright
I am not a lawyer but according to http://www.copyright.gov/circs/circ01.pdf (See screenshot of relevant section below), mentioning the first year of publication in the copyright is a good thing

![selection_008](https://cloud.githubusercontent.com/assets/829526/12409934/7021c3a6-be95-11e5-8d1a-18f6948571e0.png)

Mentioning 2010 as the first release happened at that time - https://github.com/tj/git-extras/releases/tag/0.0.1

Also adding `Contributors` to copyright because TJ Holowaychuk is not the only person owning copyright for the whole project. The copyright is collectively owned by all contributors, or more precisely: every contributor owns a copyright on the code he or she has contributed.

The only way to retain full copyright over code is to ask for signing contributor's agreement before merging in changes. This is, in fact, what some companies who license commercially their free software do.
2016-01-30 17:30:04 +05:30
Nimit Kalra edbcb3f4c0 Merge pull request #509 from supercrabtree/master
Fix Typo in `git-clear` Documentation.
2016-01-30 00:25:59 -06:00
George Crabtree 511c135e2f Fix typo in git-clear documentation 2016-01-28 22:18:36 +11:00
Nimit Kalra 8a8a483f41 Bump version to 4.2.0-dev. 2016-01-24 15:07:09 -06:00
Nimit Kalra 0ca4c6f221 Version 4.1.0 2016-01-24 15:04:10 -06:00
hemanth.hm 5b45eb702b Merge pull request #503 from spacewander/fix_502
Fixes #502
2016-01-24 19:48:38 +05:30
hemanth.hm a4a001dde9 Merge pull request #507 from rstacruz/git-pr-manual
Regerenate git-pr.html
2016-01-23 18:10:41 +05:30
Rico Sta. Cruz 9d2df44d18 Regerenate git-pr.html 2016-01-22 20:51:36 +08:00
hemanth.hm e6cdd2cf56 Merge pull request #506 from rstacruz/git-pr-manual
Update git PR manual to mention URLs
2016-01-22 15:39:24 +05:30
Rico Sta. Cruz 0fde295f5e Update git PR manual to mention URLs 2016-01-22 18:01:28 +08:00
spacewander a192fe688a handle GIT_EDITOR which contains space 2016-01-20 18:48:19 +08:00
spacewander afce25cd65 use ps -f and awk to emulate pgrep
There is no pgrep in git for windows
2016-01-20 11:39:25 +08:00
Nimit Kalra 98d0d8c642 Merge pull request #500 from kumon/master
Add "sync" command.
2016-01-16 23:41:03 -06:00
Takuma Yamaguchi f0ecd82129 add upstream check & bugfix 2016-01-17 00:56:45 +09:00
Takuma Yamaguchi 19ece6192e add example of git-sync 2016-01-16 01:47:30 +09:00
Takuma Yamaguchi 3481ff245e upstream is used by default 2016-01-16 01:40:10 +09:00
Nimit Kalra 642eedeab5 Merge pull request #497 from JanSchulz/win_inst2
Update windows install.cmd
2016-01-14 12:49:25 -06:00
Takuma Yamaguchi 12e416a324 add git-sync 2016-01-14 00:19:12 +09:00
Nimit Kalra e7083decec Merge pull request #499 from tj/add-bsd-installation
Add BSD installation instructions.
2016-01-09 18:03:36 -06:00
Nimit Kalra e6398ba24f Add BSD installation instructions.
Fixes #498.
2016-01-09 18:03:19 -06:00
Jan Schulz 64f9e4d797 installation.md: Update information about column.exe
column.exe will be available in the next git release:
https://github.com/git-for-windows/build-extra/pull/92

Also convert tabs to spaces... Was mixed up to now :-/
2016-01-06 15:54:04 +01:00
Jan Schulz 6bf64fbb23 install.cmd: add a check for write rights to the install folder
This was happening earlier as well, but the error messages were the
raw messages from the failed writes...
2016-01-06 15:54:03 +01:00
Jan Schulz a20d4bc890 install.cmd: properly escape the ! in the shebang line
This was a regression introduced by the useage of `enabledelayedexpansion`,
which results in `!` treated as variable identifier like `%`. The result
was that git didn't treat the scripts as git commands...
2016-01-06 15:53:49 +01:00
hemanth.hm 2ef6df6182 Merge pull request #496 from JanSchulz/win_inst
Make the win installer more robust
2016-01-06 12:43:58 +05:30
Jan Schulz 672c87e9e4 Make the win installer more robust
User visible:
* Also accept the git install path (and not the mingw64 subdir) as a user
  supplied install location. Make it the new default and warn the user if
  a mingw64 dir is supplied (=this dir is not checked, so it might be
  anywhere...)
* Find git.exe in path and use that as an install location
* Add error|status messages and output less noise (robocopy)
* do some check if column.exe is not found...
* adjust the installation text for windows...

not user visible:
* more.exe does not work when used in a cmd which has a unicode codepage
  -> save the current codepage and set a sane default during the install
* do some "magic" with quotes around path variables -> makes it work with
  pathes with spaces in it (both final git dir and the git-extra checkout)
* Do not leak variables to the sourounding interpreter
2016-01-05 15:57:09 +01:00
hemanth.hm ef73afb39e Merge pull request #494 from apjanke/fix-git-repo-inclusion
Makefile: fix inverted list of commands that use is_git_repo
2016-01-05 16:27:11 +05:30
hemanth.hm cf0fa9da2d Merge pull request #495 from JanSchulz/patch-1
Update Installation.md
2016-01-05 15:58:38 +05:30
Jan Schulz 7ec7a18671 Update Installation.md
Update windows install instructions.
2016-01-05 11:24:41 +01:00
Andrew Janke a1530d90f2 Makefile: fix inverted list of commands that use is_git_repo 2015-12-31 20:28:13 -05:00
Nimit Kalra 90ba942cf6 Add Gitter badge. 2015-12-29 12:31:11 -06:00
Nimit Kalra 39ed77253c Bump version to 4.1.0-dev. 2015-12-29 00:03:19 -06:00
Nimit Kalra 94556f380b Version 4.0.0 2015-12-28 22:42:20 -06:00
Nimit Kalra bb02bdcd55 Add David Rogers to AUTHORS. 2015-12-28 22:32:11 -06:00
Nimit Kalra 1ff64e2fed Merge pull request #481 from al-the-x/multi-file-touch
Make `git-touch` behave like `touch` when passed multiple files.
2015-12-28 22:17:01 -06:00
David Rogers 2b042bdd59 Better USAGE message 2015-12-28 14:07:09 -05:00
David Rogers 64639e1437 Touch multiple files supplied 2015-12-28 14:06:30 -05:00
David Rogers 3c874ce9f4 Use $@ instead of $* re #467
Blind first pass so that I have a PR to remind me...
2015-12-28 13:53:49 -05:00
Nimit Kalra 176ebf9da1 Update AUTHORS. 2015-12-28 01:32:21 -06:00
Nimit Kalra 168f59e772 Merge pull request #490 from apjanke/etc-under-prefix
installation: put $SYSCONFDIR (etc) under $PREFIX by default
2015-12-28 00:01:31 -06:00
Andrew Janke cbad7c63eb installation: put $SYSCONFDIR (/etc) under $PREFIX by default 2015-12-28 00:45:04 -05:00
Nimit Kalra d46c515d6d Merge pull request #489 from apjanke/customize-etcdir
Makefile: allow customizing of SYSCONFDIR (/etc) location.
2015-12-27 17:11:02 -06:00
Andrew Janke 4354cca461 Makefile: allow customizing of SYSCONFDIR (/etc) location 2015-12-27 17:14:17 -05:00
Nimit Kalra 4c06b7f074 Merge pull request #488 from apjanke/git-clear-shebang
Fix missing shebang in git-clear and missing +x on others.
2015-12-27 14:10:56 -06:00
Andrew Janke a09eefde25 Fix missing shebang in git-clear and missing +x on others 2015-12-27 15:02:55 -05:00
Nimit Kalra 91ca995edc Update all man pages. 2015-12-27 11:26:38 -06:00
hemanth.hm 35e1f7845a Merge pull request #479 from JanSchulz/global_gitignore
Add more info how to set global gitignore
2015-11-03 07:47:46 +05:00
hemanth.hm 1d8534b9cd Merge pull request #448 from Lee-W/master
Add git-ignore-io
2015-10-28 10:15:40 +05:30
Jan Schulz b4f4dd1197 Add more info how to set global gitignore 2015-10-22 11:28:17 +02:00
Nimit Kalra 106acae943 Regenerate git-changelog man pages (.html and .1) for #471. 2015-10-18 13:44:45 -05:00
Nimit Kalra b804d36a21 Merge pull request #471 from JanSchulz/merge-changelog
git-changelog: option to only use merges
2015-10-18 13:22:30 -05:00
Jan Schulz 5a80928b89 git-changelog: option to only use merges
using `-m` or `--merges-only` will only show the merge
commit messages. It will also use the body of the merge
commit message in addition to the subject, as github merges
usually have a useless subject line for commit messages.

If used with `-n/--no-merges`, the last one specified will win.
2015-10-18 16:11:10 +02:00
hemanth.hm 889a65883f Merge pull request #469 from JanSchulz/windows-install
Use the default installation path in install.cmd
2015-10-18 18:36:42 +05:30
hemanth.hm 7dce2bbbdf Merge pull request #468 from spacewander/use-real-purplish
use real purplish
2015-10-18 18:36:22 +05:30
Jan Schulz 546ddf78af Use the default installation path in install.cmd 2015-10-17 12:25:14 +02:00
spacewander 7f662708fa use real purplish 2015-10-13 23:54:52 +08:00
hemanth.hm f799e96910 Merge pull request #466 from anarcat/master
add simple sed command
2015-10-10 09:43:36 +05:30
hemanth.hm dfe0c79f45 Merge pull request #465 from spacewander/fix-color
Fix color
2015-10-10 09:42:55 +05:30
Antoine Beaupré 4b795fc42f add simple sed command 2015-10-08 16:13:27 -04:00
spacewander 77f1c86b0d disable color if the output is not printed to tty 2015-10-08 16:45:53 +08:00
spacewander 02a440953b replace wildcard '?' to literal '?'
Previously the `?` in the case statement will match any single letter.
As a result, `git scp a` will act as the same as `git scp -h`.
What we actually need is a literal '?'.
2015-10-08 14:06:46 +08:00
spacewander 7ae2e0b9ef git-scp: use portable terminal escape sequences 2015-10-08 10:24:31 +08:00
hemanth.hm c4cd2ca34d Merge pull request #460 from apjanke/summary-defensive-locale
git-summary: protect against character encoding issues with LC_ALL=C
2015-10-02 22:05:27 +05:30
hemanth.hm d82c9b4576 Merge pull request #458 from apjanke/makefile-refactor-libs
Makefile: refactor is-git-repo inclusion logic
2015-10-02 22:05:09 +05:30
hemanth.hm 166f9599e7 Merge pull request #459 from apjanke/effort-portable-colors
git-effort: use portable terminal escape sequences
2015-10-02 22:03:54 +05:30
Andrew Janke 19f66943cb git-summary: protect against character encoding issues with LC_ALL=C 2015-10-02 08:35:04 -04:00
Andrew Janke b2817c7299 git-effort: use portable terminal escape sequences
Also uses "default color" instead of "black" for the low-activity things, so
it still shows up on colorschemes that have dark backgrounds.
2015-10-02 06:35:38 -04:00
Andrew Janke ed7dcb7682 Makefile: refactor is-git-repo inclusion logic
This avoids the need for a big repeated block of code.
2015-10-02 05:47:08 -04:00
hemanth.hm faaae9fa6b Merge pull request #454 from apjanke/makefile-escape-mktemp
Makefile: escape $ used inside eval as shell variable
2015-10-02 13:35:35 +05:30
Andrew Janke 5b285380e7 Makefile: escape $ used inside eval as shell variable 2015-10-02 03:48:53 -04:00
hemanth.hm cc488a035d Merge pull request #453 from jhnns/pr-url
Add possibility to also checkout pull requests based on GitHub urls
2015-09-26 13:16:36 +05:30
Johannes Ewald 7b74567550 Add possibility to also checkout pull requests based on GitHub urls 2015-09-24 16:11:06 +02:00
hemanth.hm bb1623ba5d Merge pull request #452 from akimd/summary-locale
summary: beware of locale issues, and pass options to line-summary
2015-09-23 23:00:42 +05:30
Akim Demaille 5f61bfad6e summary: beware of locale issues, and pass options to line-summary
* bin/git-summary: here.
2015-09-23 19:27:19 +02:00
hemanth.hm 332bec0f1a Merge pull request #443 from Natim/patch-1
Make sure git-authors doesn't return twice the same ones.
2015-09-22 11:44:40 +05:30
hemanth.hm 91aff4fe20 Merge pull request #444 from spacewander/install_without_alias
add alias conflict prompt
2015-09-22 11:44:22 +05:30
hemanth.hm f8b81131a5 Merge pull request #446 from ssssam/fix-active-days
effort, summary: Correctly estimate the number of active days
2015-09-22 11:44:11 +05:30
hemanth.hm 60098c9629 Merge pull request #447 from RichardLitt/patch-1
Alphabetized list
2015-09-22 11:43:56 +05:30
LeeW 81e8a45b38 Update git-ignore-io mannual 2015-09-20 18:44:40 +08:00
LeeW 37d6012791 Replace "export" option with "replace" in git-ignore-io 2015-09-19 09:54:53 +08:00
LeeW 07505518fa Remove exclamation mark 2015-09-19 01:00:31 +08:00
LeeW 88c3437a24 Remove warning when search without word.
* Show usage only
2015-09-19 00:42:23 +08:00
LeeW b517022e15 Fix typo 2015-09-19 00:37:38 +08:00
LeeW 8d0eae5c7f Add warning when there is not argument after search, append and export 2015-09-17 21:32:10 +08:00
LeeW 61bfc44eec Fix ~/.gi_list not exist problem 2015-09-17 21:19:45 +08:00
Richard Littauer c0ad975f22 Alphabetized list 2015-09-14 11:01:35 -04:00
Sam Thursfield 6a000ec99b effort, summary: Correctly estimate the number of active days
The output of `git log` is not exactly in chronological order. The
default sort option (--date-order) is described in the man page as
follows:

    Show no parents before all of its children are shown, but otherwise
    show commits in the commit timestamp order.

The `uniq` program will only remove duplicate lines if they follow each
other. In order for this to work correctly, we need to ensure that the
list of dates is exactly in chronological order. There doesn't seem to
be a `git log` option to achieve this, but we can use the `sort`
program. I used reverse sort (`sort -r`) since the output will be roughly
reverse-sorted already.

It's also worth noting that the default --date-order option sorts by
commit date, but git-summary uses *author* date (%ai). Passing
--author-date-order doesn't fix this issue, though, so I didn't change
that.

At the time of writing, this change reduces the number of 'active days'
for git-extras.git from 367 to 331.
2015-09-14 13:32:10 +01:00
hemanth.hm c8aca55cd7 Merge pull request #445 from nicolaiskogheim/straighten-up-effort
Straighten up effort
2015-09-14 14:55:54 +05:30
Nicolai Skogheim 80f060b213 effort: change order of arguments to function
This makes git effort less prone to failing if
someone passes formatting options
2015-09-14 00:00:39 +02:00
Nicolai Skogheim e91fd9623f effort: add usage message 2015-09-13 23:56:56 +02:00
Nicolai Skogheim 86e1a7014c effort: More robust argument parsing
Why:

* The old way of handling arguments could make it
difficult to make non-breaking changes because
to be able to handle more arguments than the
'--above' argument, the logic would need to be heavily
refactored and demand restrictions on argument order.

This change addresses the need by:

* Parse arguments in a cleaner way
* Make the command more future proof with respect to arguments

Notable change is the synopsis. Please the see man page.
2015-09-13 23:55:28 +02:00
spacewander 9916356b14 add alias conflict prompt 2015-09-13 09:55:49 +08:00
hemanth.hm 26a8b901a0 Merge pull request #440 from spacewander/features/feature-alias
add alias to git-feature
2015-09-12 11:49:01 +05:30
LeeW 490d12b6f7 Add full name for list option 2015-09-12 08:15:29 +08:00
LeeW 0393d560f8 Fix usage error 2015-09-12 08:04:47 +08:00
Rémy HUBSCHER 639210660e Make sure git-authors doesn't return twice the same one. 2015-09-11 20:14:36 +02:00
spacewander f6f45990ab update git-feature docs 2015-09-11 20:23:20 +08:00
spacewander 38c7b03372 add alias to git-feature 2015-09-11 20:23:17 +08:00
LeeW 2c1d766640 Modify print_last_modified_time to make it Linux compatible 2015-09-09 18:42:28 +08:00
hemanth.hm 80a7928b67 Merge pull request #441 from spacewander/features/remove-checkout
remove duplicate checkout
2015-09-08 20:16:23 +05:30
LeeW 9b89da3a95 Merge branch 'master' of https://github.com/Lee-W/git-extras 2015-09-08 21:04:32 +08:00
LeeW b988558ea4 Fix doc error for git-ignore-io 2015-09-08 21:04:13 +08:00
LeeW 469434a8eb Fix doc error for git-ignore-io 2015-09-08 21:01:20 +08:00
LeeW 6073594656 Remove redundant \n in tr 2015-09-08 20:59:08 +08:00
LeeW fed97bf8db Not to update list each time git-ignore-io is executed
* Check whether the list exists. If not, get it.
* Update should use -u option manually
2015-09-08 20:57:06 +08:00
LeeW 3ad2f6fa4a Refactor git-ignore-io and remove .gitignore 2015-09-08 20:23:53 +08:00
LeeW ccd5303040 Update manual and description in Commands 2015-09-08 19:42:20 +08:00
spacewander a7f830b1e7 remove duplicate checkout 2015-09-08 16:08:50 +08:00
LeeW 967b51c964 Generate manual using ronn for git-ignore-io 2015-09-07 22:37:56 +08:00
LeeW 2ced182fcc Finish manual for git-ignore-io 2015-09-07 22:24:40 +08:00
LeeW 98bbfe7968 Fix typo 2015-09-07 22:20:20 +08:00
LeeW a1d0445cc1 Add description to Commands.md for git-ignore-io 2015-09-07 21:41:59 +08:00
LeeW 4a8037fa62 Implement search function or git-ignore-io 2015-09-06 22:49:32 +08:00
LeeW d87599c344 Remove help from git-ignore-io 2015-09-06 22:18:29 +08:00
LeeW 37aacf3e41 Init gitignore and ignore vim osx temp files 2015-09-06 20:01:34 +08:00
LeeW 87d61693b1 Merge gi_extension project into git extras as git-ignore-io
* gi_extension(https://github.com/Lee-W/gi_extension)
2015-09-06 19:58:17 +08:00
hemanth.hm bb4acf0757 Merge pull request #436 from nwinkler/patch-1
Updated documentation for git-ignore
2015-09-05 16:44:36 +05:30
hemanth.hm 0e05f63147 Merge pull request #437 from nwinkler/patch-2
Fixed typo in install.sh
2015-09-05 16:44:14 +05:30
Nils Winkler 30747be220 Fixed typo in install.sh
s/exras/extras/
2015-09-04 13:44:51 +02:00
Nils Winkler 55bfebbc21 Updated documentation for git-ignore
* Updated output for `git ignore`
* Added description and examples for `git ignore -g` and `git ignore -l`
2015-09-04 11:09:32 +02:00
hemanth.hm e042c5ceb7 Merge pull request #435 from nwinkler/patch-1
Added details to git-pr documentation
2015-09-03 14:22:15 +05:30
Nils Winkler da76b2ae86 Added details to git-pr documentation
Details for:

* Using a remote other than `origin` by providing it in the second parameter.
* Using the `clean` parameter to remove all local `pr/*` branches.
2015-09-03 10:50:27 +02:00
hemanth.hm 1eba324e94 Merge pull request #433 from grindhold/git-clear
Git clear
2015-09-03 11:30:34 +05:30
grindhold a66c9446b5 made more precise security-question. 2015-09-01 15:17:14 +02:00
grindhold dae38840f9 more concise implementation of git-clear 2015-09-01 13:28:29 +02:00
Nicolai Skogheim 0c7bf665f2 Fix typo in variable name 2015-08-29 15:31:10 +02:00
grindhold ecf7f05f12 added git-clear to Commands.md 2015-08-26 22:20:09 +02:00
grindhold 2c855e991c added manpage for git-clear 2015-08-26 22:13:12 +02:00
grindhold ad7811e991 implemented git-clear
i wanted a simple command to restore the state of a repo as if it was
freshly cloned with the current HEAD. This is basically git reset --hard
with deletion of all untracked files that are in the repo.
2015-08-26 21:58:22 +02:00
hemanth.hm dae750f734 Merge pull request #432 from stevemao/patch-1
fix link of `git feature|refactor|bug|chore`
2015-08-26 12:08:21 +05:30
Steve Mao 7b06400ac7 fix link of git feature|refactor|bug|chore 2015-08-25 16:00:39 +10:00
hemanth.hm 6808b0fd79 Merge pull request #425 from nicolaiskogheim/makefile-fix
Set default make task to be install
2015-08-20 16:28:43 +05:30
Nicolai Skogheim 7e147993d4 Mark default task as .PHONY 2015-08-20 12:47:50 +02:00
hemanth.hm afb905c5ae Merge pull request #430 from spacewander/git-extras
make it possible to update via `git extras`
2015-08-16 09:28:41 +05:30
luozexuan 5fb7f6b77c make it possible to update via git extras 2015-08-16 11:47:16 +08:00
hemanth.hm 3b02c65a94 Merge pull request #428 from spacewander/update-commands
update Commands.md
2015-08-14 17:12:20 +05:30
hemanth.hm ad83e447a6 Merge pull request #429 from nicolaiskogheim/merge-into-ff-only
merge-into: change --ff option to --ff-only
2015-08-14 17:12:05 +05:30
Nicolai Skogheim 2d8b703e7c merge-into: change --ff option to --ff-only. fix #421 2015-08-14 13:03:39 +02:00
luozexuan 11fd45791b update Commands.md 2015-08-14 14:49:32 +08:00
hemanth.hm 17b82ec9ee Merge pull request #411 from Natim/add-psykorebase-command
Add the git-psykorebase command.
2015-08-11 16:02:39 +05:30
Rémy HUBSCHER fa4c5dd456 Improve man page presentation. 2015-08-11 11:30:36 +02:00
Rémy HUBSCHER 84699acc6e Add documentation. 2015-08-11 11:26:52 +02:00
hemanth.hm 3632ad959f Merge pull request #426 from spacewander/update-for-new-version
abort git-alias when too many arguments given.
2015-08-09 17:21:42 +05:30
spacewander 9859396131 change 'search-term' to 'search-pattern' 2015-08-09 19:33:13 +08:00
spacewander 98a1820d39 abort git-alias when too many arguments given.
Avoid incorrect usage probably because of the missing quotes, like "git
alias cm checkout master"
2015-08-09 19:27:49 +08:00
hemanth.hm ad75f873af Merge pull request #423 from nicolaiskogheim/effort-paths
effort: document that it takes any path, not just filenames
2015-08-08 20:46:25 +05:30
hemanth.hm dc498c0614 Merge pull request #424 from nicolaiskogheim/fork-docs
fork docs: change SSH to HTTPS in example
2015-08-08 20:45:39 +05:30
hemanth.hm 2912d3522c Merge pull request #422 from nicolaiskogheim/effort-bugfix
effort: fix active days always 1
2015-08-08 20:43:27 +05:30
Nicolai Skogheim b1fba8f3fe effort docs: add note about omitting unsorted results 2015-08-08 09:06:54 +02:00
Nicolai Skogheim d51f4fde37 effort docs: add example with directories 2015-08-08 09:06:54 +02:00
Nicolai Skogheim d367affd57 effort docs: filename -> path 2015-08-08 09:06:54 +02:00
Nicolai Skogheim 96329378b9 effort docs: Adjust numbers in example
The values shown can never appear, and makes no sense.
2015-08-08 09:06:54 +02:00
Nicolai Skogheim 4527656f7c effort: rename 'file' to 'path' to be more accurate 2015-08-08 09:06:54 +02:00
Nicolai Skogheim bd05487375 Set default make task to be install 2015-08-08 07:06:31 +02:00
Nicolai Skogheim 09e039ceae fork docs: change SSH to HTTPS in example 2015-08-08 05:06:31 +02:00
Nicolai Skogheim 7de280f12f effort: fix active days always 1
Introduced in cdb773c06 (Fix error on FreeBSD with process substitution)
when trying to squash a bug.
This fix should be valid for that bug as well.
2015-08-08 02:44:55 +02:00
hemanth.hm 2113e8c1d7 Merge pull request #419 from nicolaiskogheim/git-guilt
[RFC] guilt: small fixes
2015-08-07 16:43:09 +05:30
hemanth.hm 5c27f6b2d1 Merge pull request #420 from nicolaiskogheim/git-summary
summary and line-summary. docs and style
2015-08-07 16:42:40 +05:30
Nicolai Skogheim ff4ad92a7a line-summary: 'function f{...' -> 'f() {...'
We use this style more often
2015-08-07 08:36:56 +02:00
Nicolai Skogheim 40023f9f14 line-summary: add missing quotation marks 2015-08-07 08:36:56 +02:00
Nicolai Skogheim b9ca124980 line-summary: tighten regex 2015-08-07 08:36:56 +02:00
Nicolai Skogheim 7fbe00c311 summary docs: Remove --line example
Since using --line only makes git-summary call git-line-summary
the example is redundant. It is also somewhat smelly to document
other functions than it's own like that.
2015-08-07 08:36:55 +02:00
Nicolai Skogheim ca4cb46dde summary docs: explain relation to git-line-summary 2015-08-07 08:36:55 +02:00
Nicolai Skogheim cdc4d8a0cf summary docs: use correct order of arguments
If you were to follow the docs on git-summary(1),
it would crash.
2015-08-07 08:36:55 +02:00
Nicolai Skogheim 8b4e50f74a guilt: remove --help option
git overrides execution when --help is given,
showing the man page for the command
2015-08-07 08:35:32 +02:00
Nicolai Skogheim aeebb1c1c1 guilt: document call without arguments 2015-08-07 08:35:32 +02:00
Nicolai Skogheim a212a78c1b guilt docs: Capitalize letters 2015-08-07 08:35:32 +02:00
Nicolai Skogheim ea0af0c391 guilt: Adds simplified example 2015-08-07 08:35:32 +02:00
hemanth.hm 8a559a070a Merge pull request #418 from nicolaiskogheim/fork-bugfix
fork: http-urls had colon instead of slash
2015-08-05 11:58:26 +05:30
spacewander d5e10f6701 add missing git-obliterate documentation 2015-08-05 10:51:08 +08:00
Nicolai Skogheim 8f1729d5f7 fork: http-urls had colon instead of slash 2015-08-05 04:27:32 +02:00
hemanth.hm db95415385 Merge pull request #416 from nicolaiskogheim/fork-docs
fork: original->upstream in docs
2015-08-05 03:12:02 +05:30
hemanth.hm f943a2db50 Merge pull request #415 from nicolaiskogheim/contrib-docs
contrib: update docs
2015-08-05 03:11:37 +05:30
Nicolai Skogheim 04b63cbc10 fork: original->upstream in docs 2015-08-04 19:53:49 +02:00
Nicolai Skogheim 7b287a8ea7 contrib: update docs 2015-08-04 19:19:46 +02:00
hemanth.hm ddfd3d9752 Merge pull request #414 from nicolaiskogheim/alias-docs
alias: docs
2015-08-04 06:17:23 +05:30
Nicolai Skogheim c4ffb30410 alias: docs
Fixes a formatting issue (markdown).
Ran manning-up.sh, which brought in changes
from an earlier commit also
2015-08-04 02:32:58 +02:00
spacewander 94bf129721 now we can specify a commit range for git-obliterate 2015-08-01 20:39:02 +08:00
Rémy HUBSCHER 3039f9405e Add completion for git-psykorebase. 2015-07-31 17:06:22 +02:00
Rémy HUBSCHER d8395ba2e9 Create a bash version of git-psykorebase — Fixes #411 2015-07-31 16:22:58 +02:00
hemanth.hm 3c5523617e Merge pull request #409 from nicolaiskogheim/refactor-alias
Refactor alias
2015-07-29 17:51:23 +05:30
Nicolai Skogheim 9629fdf13c alias: polish the docs 2015-07-29 13:19:18 +02:00
Nicolai Skogheim 24ad1c8281 alias: bugfix
'git alias <search-term>' did not work.
2015-07-29 13:15:34 +02:00
hemanth.hm 3a8c947922 Merge pull request #408 from nicolaiskogheim/refactor-contrib
contrib: refactor, and conform to git
2015-07-29 16:06:42 +05:30
Nicolai Skogheim 4b4276e3fc contrib: refactor, and conform to git 2015-07-29 12:03:45 +02:00
hemanth.hm 371dcdff13 Merge pull request #405 from nicolaiskogheim/fix-filenames-with-spaces
Make git effort not crash when passed file names with spaces
2015-07-29 13:36:24 +05:30
hemanth.hm 46db56905d Merge pull request #404 from nicolaiskogheim/freebsd-fix
Make git effort run on FreeBSD
2015-07-29 13:36:00 +05:30
hemanth.hm f0194060c5 Merge pull request #406 from nicolaiskogheim/portable-msysgit
Portable msysgit
2015-07-29 13:35:09 +05:30
NANRI 22406cef6a git-alias: use sed insted of colrm
PortableGit doesn't have colrm command.
2015-07-29 08:39:07 +02:00
NANRI 5e14c08fc5 git-changelog: use cp instead of mv
mv command cannot overwrite in PortableGit(msysgit).
2015-07-29 08:27:30 +02:00
NANRI 434b7681ce git-extras: use git-help instead of man
PortableGit doesn't have man command.
2015-07-29 08:23:25 +02:00
NANRI 36f8f2ba1e add install script for PortableGit(msysgit)
$(BINS)     => /bin
$(MAN_HTML) => /doc/git/html
2015-07-29 08:20:10 +02:00
Nicolai Skogheim 526fb77823 Quote variables bc of filenames with spaces 2015-07-29 05:10:52 +02:00
Nicolai Skogheim 1956d385bd Guard against 'seq 0'
Most implementations of seq yields no output for 'seq 0',
but some yields '1(newline)0'.
2015-07-28 21:23:50 +02:00
Nicolai Skogheim cdb773c065 Fix error on FreeBSD with process substitution 2015-07-28 20:41:53 +02:00
Nicolai Skogheim 20e6455559 Pass --import-functions if required
This patch is the reason for this commit:
https://lists.freebsd.org/pipermail/svn-ports-all/2014-September/075090.html
2015-07-28 06:13:59 +02:00
hemanth.hm 8dbcd446db Merge pull request #403 from andreicristianpetcu/master
effort: documentation for git effort --since #326
2015-07-27 18:09:11 +05:30
Andrei Petcu c2ea7f081a effort: documentation for git effort --since #326 2015-07-27 15:23:57 +03:00
hemanth.hm f40e6c37a6 Merge pull request #401 from nicolaiskogheim/effort-above-error-on-NaN
effort: error out on bad value to --above
2015-07-25 13:05:00 +05:30
Nicolai Skogheim 6ebfdc5329 effort: error on bad value to --above 2015-07-25 09:09:39 +02:00
hemanth.hm d97faf2424 Merge pull request #400 from nicolaiskogheim/fix-off-by-one
effort: don't count untouched files
2015-07-25 12:17:34 +05:30
hemanth.hm 651a2bac97 Merge pull request #391 from nicolaiskogheim/effort-limit-commits
[RFC] effort: Allow sending options to log. Fix #326
2015-07-25 11:52:06 +05:30
hemanth.hm 467d52a73e Merge pull request #388 from chernjie/release
Run manning-up.sh
2015-07-25 11:51:06 +05:30
hemanth.hm 3dcf09f883 Merge pull request #398 from nicolaiskogheim/git-graft
graft: Require destination branch. Fix #23
2015-07-25 11:50:43 +05:30
hemanth.hm b99a84691e Merge pull request #399 from nicolaiskogheim/git-archive-file
archive-file: cleaner way to get current branch
2015-07-25 11:50:00 +05:30
Nicolai Skogheim 95db4e7ad5 archive-file: cleaner way to get current branch 2015-07-25 06:09:43 +02:00
Leila Muhtasib 3d0b4feb80 graft: Require destination branch. Fix #23
This is to avoid the old behaviour of automatically
merging into master.
2015-07-25 04:16:09 +02:00
Nicolai Skogheim 329106c845 effort: don't count untouched files 2015-07-25 03:16:18 +02:00
Nicolai Skogheim 78de79ce96 Add info about new options to man pages 2015-07-24 18:57:46 +02:00
Nicolai Skogheim 6ba68941e8 Add completion for more options to effort 2015-07-24 18:57:46 +02:00
Nicolai Skogheim ba5e5989a3 Do proper argument parsing 2015-07-24 18:57:34 +02:00
Nicolai Skogheim fd72edd98f effort: allow sending options to log. Fix #326 2015-07-23 01:15:10 +02:00
hemanth.hm 7d1ede1022 Merge pull request #396 from tocker/bug/changelog-catch-head
Catch "HEAD -> master" when creating the changelog
2015-07-20 12:26:31 +05:30
Amir Tocker 7ddd1f7a60 Catch "HEAD -> master" when creating the changelog
git log may report `(HEAD -> master, tag:...)` instead of `(HEAD, tag:...)`.
2015-07-20 09:38:14 +03:00
hemanth.hm 8652172f9b Merge pull request #394 from markeissler/changelog-signal-trap
Handle signals in git-changelog.
2015-07-16 09:25:45 +05:30
Mark Eissler 4ff5dc1ee0 Remove unused var. 2015-07-15 08:34:06 -07:00
hemanth.hm d0e667961c Merge pull request #390 from nicolaiskogheim/effort-color-relative-to-above
effort: Make coloring respect --above. Fix #74
2015-07-12 22:11:41 +05:30
Mark Eissler 4fd095b741 Handle signals in git-changelog. 2015-07-10 18:11:18 -07:00
Nicolai Skogheim a7064395c2 Meke coloring respect --above. Fix 74 2015-07-10 03:29:09 +02:00
hemanth.hm fa3cf6ab41 Merge pull request #392 from nicolaiskogheim/WIP-effort-parallelize
[RFC] Improve speed of git effort
2015-07-10 05:44:00 +05:30
Nicolai Skogheim 935c5a37b3 Avoid spawning subshell 2015-07-08 18:59:10 +02:00
Nicolai Skogheim 39238ded46 Remove unnecessary call to cat 2015-07-08 18:56:00 +02:00
Nicolai Skogheim 203b7649a2 perf: reduce calls to git log 2015-07-08 18:52:51 +02:00
Nicolai Skogheim 73973049d6 Parallelize git-effort with xargs 2015-07-08 18:45:41 +02:00
Nicolai Skogheim cb15c94eab Alter options to git log. Remove pipe 2015-07-08 17:58:12 +02:00
CJ fea722e7e9 cd man && ./manning-up.sh && git diff --stat | grep ' 2 ' | awk '{print }' | xargs git checkout -- 2015-06-27 17:13:43 +08:00
hemanth.hm 392a2d67db Merge pull request #386 from rstacruz/patch-2
Use https for git-fork
2015-06-23 10:45:13 +05:30
Rico Sta. Cruz 13842de9e0 Use https for git-fork 2015-06-23 12:57:30 +08:00
hemanth.hm dc208cddda Merge pull request #385 from gisphm/master
add install.cmd for installation on windows
2015-06-21 01:33:54 +05:30
gisphm 3707e2e826 added windows installation section in the Installation.md
Signed-off-by: gisphm <phmfk@hotmail.com>
2015-06-21 01:59:43 +08:00
gisphm fd4fbd3950 format install.cmd
Signed-off-by: gisphm <phmfk@hotmail.com>
2015-06-21 01:06:47 +08:00
gisphm 3f7bcba984 add install.cmd for installation on windows
The script install.cmd has two environment variables PREFIX and HTMLDIR.
PREFIX is where your git is installed and HTMLDIR is the location of html files under PREFIX.
This script is written for msysgit installed from https://github.com/git-for-windows/git.

Signed-off-by: gisphm <phmfk@hotmail.com>
2015-06-20 19:18:04 +08:00
hemanth.hm dafb457e81 Merge pull request #383 from Somasis/master
Makefile: Use a more portable mktemp invocation
2015-06-12 21:45:09 +05:30
Kylie McClain a56d2a17e4 Makefile: Use a more portable mktemp invocation 2015-06-11 20:05:01 -04:00
hemanth.hm 8a3f9884c8 Using shorter URL
^
2015-06-08 09:24:16 +05:30
hemanth.hm 96bb7cb873 Merge pull request #381 from spacewander/master
installation with curl and bash
2015-06-08 09:19:37 +05:30
spacewander 51fbc16913 installation with curl and bash 2015-06-08 00:09:40 +08:00
hemanth.hm 02d6222031 Merge pull request #380 from spacewander/master
keep installation silent
2015-06-07 18:39:48 +05:30
spacewander 84c2d1014b keep installation silent 2015-06-07 20:57:39 +08:00
hemanth.hm f754d38f30 Merge pull request #378 from spacewander/master
update installation in `git-extras update`
2015-05-30 12:41:57 +05:30
spacewander a498332c96 update installation in git-extras update 2015-05-30 12:31:23 +08:00
hemanth.hm 8283401d2b Merge pull request #377 from go2null/master
FIXes 'mktemp' to work again on Linux
2015-05-29 09:09:24 +05:30
go2null a67b42711d FIXes location of -- for grep
Broken in 5b1ac3ccc6

`--` must be after all parameters (options), and before positional arguments

See https://unix.stackexchange.com/questions/11376/what-does-double-dash-mean-also-known-as-bare-double-dash
2015-05-28 11:59:29 +00:00
go2null c7635f8f21 FIXes 'mktemp' to work again on Linux
Broken in 67241a46a8

`mktemp` for BSD (including OSX) requires a template, but it allows any number
of `X`s in the template.

(GNU) `mktemp` for Linux does not require a template, however, if a template is
specified, then the number of `X`s must be 6.

See http://unix.stackexchange.com/a/206111/117157
2015-05-28 11:22:52 +00:00
hemanth.hm aecef0eaed Merge pull request #373 from zlx/feature/document_line_summary
Document for git-line-summary
2015-05-15 12:23:57 +05:30
Newell Zhu 69af52b99e Document for git-line-summary 2015-05-14 22:13:37 +08:00
hemanth.hm a5da0ec34a Merge pull request #372 from spacewander/patch-1
Install the latest release version of git-extras
2015-05-13 21:04:04 +05:30
spacewander b1784fd378 install the latest release version of git-extras
Accoring to the talk in https://github.com/tj/git-extras/issues/371
2015-05-13 22:30:00 +08:00
hemanth.hm 9b45e6b831 Merge pull request #370 from phigoro/master
git-effort: replace "wc | cut" with "wc | awk"
2015-05-13 10:24:54 +05:30
phigoro 95e8812370 git-effort: replace "wc | cut" with "wc | awk"
It looks "cut" may have different behaviour, e.g. BSD one works the way
git-effort doesn't expect. "awk" looks to be one of possible fixes here.
2015-05-11 19:54:38 +03:00
hemanth.hm 4480479994 Merge pull request #369 from phigoro/master
align hashbang of git-guilt & git-merge-into
2015-05-10 21:27:35 +05:30
phigoro 09d967dfbd align hashbang of git-guilt & git-merge-into 2015-05-10 12:01:38 +03:00
hemanth.hm eb57e1f25c Merge pull request #368 from zlx/feature/strong_line_summary
Fix some fatal for git-line-summary
2015-05-09 16:41:44 +05:30
Newell Zhu 72f08b1095 Fix Fatal for git-line-summary
1. Fix print format with special characters
2. Fix Fatal when exist special characters in git blame output
3. Fix raise error when exist not committed new files
2015-05-09 17:07:29 +08:00
hemanth.hm 6988f4325b Merge pull request #365 from rkennedy/bug-ignore-regex2
Don't treat ignored patterns as regexps
2015-04-30 11:29:19 +05:30
Rob Kennedy e2b6eaf028 Don't treat ignored patterns as regexps
Fixes #353.
2015-04-29 22:48:16 -07:00
Hemanth.HM 438de98926 Version 3.0.0 2015-04-27 17:43:50 +05:30
hemanth.hm c85443c326 Merge pull request #363 from chernjie/pre-release-docs
ran pre-release ./manning-up.sh
2015-04-27 13:51:43 +05:30
CJ 7d3e55a84a run pre-release ./manning-up.sh 2015-04-27 15:24:13 +08:00
hemanth.hm 150f781d05 Merge pull request #362 from chernjie/git-scp
Updated documentation for git-scp and slight feature change
2015-04-27 12:37:40 +05:30
CJ 62dd4a2258 Updated documentation for git-scp and slight feature change 2015-04-27 15:05:17 +08:00
hemanth.hm 6e4152d3b0 Merge pull request #359 from chernjie/docs
Merge wiki into main repository
2015-04-27 06:33:38 +05:30
hemanth.hm d1251c21db Merge pull request #361 from markeissler/better-changelog-fixes
Fix git tag substring extraction for bash 3.2.
2015-04-26 00:32:47 +05:30
Mark Eissler 399bc037fa Fix git tag substring extraction for bash 3.2. 2015-04-25 10:12:17 -07:00
hemanth.hm e16e90e9b9 Merge pull request #360 from spacewander/master
correct the broken regex
2015-04-25 21:44:15 +05:30
hemanth.hm b84faa58b6 Merge pull request #355 from markeissler/better-changelog-fixes
Fix git-changelog for compatibility for bash<4. Fixes #337, #338
2015-04-25 20:40:19 +05:30
Mark Eissler a1ac472f9e Merge branch 'better-changelog-fixes' of github.com:markeissler/git-extras into better-changelog-fixes 2015-04-24 12:01:13 -07:00
spacewander 2810323aad add support for git version below 2.2.0 2015-04-24 12:00:17 -07:00
Mark Eissler 80d680b0a6 Fix git-changelog for compatibility for bash<4. Fixes #337, #338
Removed dependency on real associative arrays, which are not
support previous to bash 4.
2015-04-24 12:00:17 -07:00
Mark Eissler fcbb25a882 Merge pull request #1 from spacewander/better-changelog-fixes
Add support for git version below 2.2.0
2015-04-24 09:58:44 -07:00
spacewander b4a1fe0aa3 correct the broken regex
'*text' only matches string ended with 'text'. So it matches 'ASCII text',
but does not match 'ASCII text executable'. Before, `git summary
--line` just counts plain text file, now we fix it.
2015-04-24 23:13:16 +08:00
CJ 4bb6e3d47d Rearrange documentation links, see #358 2015-04-23 21:46:09 +08:00
CJ 346f5519c7 Merge branch 'https://github.com/tj/git-extras.wiki/master' into docs,
see #358

* wiki/master: (30 commits)
  git merge-repo
  add wiki for git-guilt
  Update docs for revised git-changelog.
  add wiki for git-merge-into
  git scp #300
  link to git delta
  git delta usage
  Add git-authors
  Updated Commands (markdown)
  Updated Commands (markdown)
  Updated Commands (markdown)
  Updated Commands (markdown)
  Updated Commands (markdown)
  Fix link to git feature command
  Added a footer.
  add a few keywords
  some remaining dashes
  roughly finished
  Updated Commands (markdown)
  Updated Commands (markdown)
  ...
2015-04-23 21:45:51 +08:00
hemanth.hm 3055a664f9 Merge pull request #357 from imsky/merge-repo
git-merge-repo
2015-04-20 08:31:53 +05:30
Ivan Malopinsky 05b0a5d3d5 git-merge-repo 2015-04-19 12:23:02 -04:00
Ivan Malopinsky 28982cbd2d git merge-repo 2015-04-19 11:15:33 -04:00
spacewander 34c9a486bf add wiki for git-guilt 2015-04-19 16:24:35 +08:00
spacewander c143b75711 add support for git version below 2.2.0 2015-04-18 18:11:18 +08:00
Mark Eissler 61da46ff11 Fix git-changelog for compatibility for bash<4. Fixes #337, #338
Removed dependency on real associative arrays, which are not
support previous to bash 4.
2015-04-16 14:03:47 -07:00
hemanth.hm d6c155c477 Merge pull request #349 from spacewander/git-guilt
fix indentation errors in git guilt
2015-04-12 09:13:35 +05:30
spacewander b375870693 fix indentation errors in git guilt 2015-04-12 11:22:55 +08:00
hemanth.hm 530e5778cc Merge pull request #345 from spacewander/git-guilt
Hope to fix #341
2015-04-10 05:20:54 +05:30
spacewander b109c866b7 Hope to fix #341 2015-04-10 00:58:59 +08:00
hemanth.hm c00202d51e Merge pull request #344 from Somasis/master
Prevent strange input and environment variables from causing issues
2015-04-09 09:21:25 +05:30
Kylie McClain 5b1ac3ccc6 use argument separator for usages of grep which can choke on weird input 2015-04-08 18:51:30 -04:00
Kylie McClain 336501382e helper/reset-env: helper to prevent GREP_OPTIONS from causing issues 2015-04-08 18:50:41 -04:00
hemanth.hm 23c270bc0f Merge pull request #342 from spacewander/git-guilt
add git guilt
2015-04-07 11:19:24 +05:30
spacewander 9f24b17b4a add docs for git guilt 2015-04-06 16:23:01 +08:00
spacewander 888919c2e9 add git-guilt 2015-04-06 15:59:53 +08:00
hemanth.hm a51fb418b2 Merge pull request #340 from spacewander/git-effort
sort unless there is only one item, fixes #339
2015-03-23 11:47:16 +05:30
spacewander 3330af6cd4 sort unless there is only one item 2015-03-22 22:55:15 +08:00
hemanth.hm 1a25e57069 Merge pull request #333 from paulschreiber/merged-branches
Fixes #332 git show-merged-branches and show-unmerged-branches
2015-03-18 19:12:08 +05:30
Paul Schreiber 00050b91da add show-merged-branches and show-unmerged-branches 2015-03-18 09:33:02 -04:00
hemanth.hm 4398f110f1 Merge pull request #334 from paulschreiber/dont-delete-svn-branch
when deleting merged branches, preserve "svn" branch for git-svn
2015-03-18 10:30:05 +05:30
Paul Schreiber 668cc9ef78 when deleting merged branches, preserve "svn" branch for git-svn
Fixed #328
2015-03-17 14:00:40 -04:00
hemanth.hm 9b50ce3000 Merge pull request #324 from chernjie/git-ignore
Support ~ in git-ignore.
2015-03-17 13:24:23 +05:30
hemanth.hm d8d33f5a3e Merge pull request #331 from markeissler/better-changelog-fixes
git-changelog fixes
2015-03-17 09:18:52 +05:30
Mark Eissler fbe171e280 Fix tag trapping when HEAD and tag point to same commit.
When the last tag is also the last commit, then we need to account
for a much longer tag output:

  HEAD, tag: v1.0.1, origin/master, origin/HEAD,...

This fix strips out 'HEAD', the rest is handled by existing code.
2015-03-16 13:37:53 -07:00
Mark Eissler 29cd63bea2 Fix gitflow commit history output.
When gitflow is used, commits on merged feature branches were
appearing in the generated output with tags labeled as:

  origin/feature/BRANCH_NAME

This fix filters out any 'tags' that include forward slashes,
which eliminates this behavior. The commits then appear as part
of the tag they were merged in with.
2015-03-16 12:16:10 -07:00
hemanth.hm 055abc3e4c Merge pull request #327 from markeissler/better-changelog-completion
Updated bash completions for better-changelog.
2015-03-14 12:08:23 +05:30
Mark Eissler de8d216c54 Updated bash completions for better-changelog. 2015-03-13 18:39:50 -07:00
Mark Eissler 634fbb54b8 Update docs for revised git-changelog. 2015-03-13 16:15:58 -07:00
hemanth.hm e4ea8690db Merge pull request #325 from markeissler/better-changelog
Complete rewrite to support commit ranges for pretty and list output.
2015-03-12 11:38:08 +05:30
Mark Eissler 49e8cf17a4 Complete rewrite to support commit ranges for pretty and list output. 2015-03-11 11:43:35 -07:00
CJ 522213a28f Support ~ in add_patterns for git-ignore 2015-03-11 15:00:30 +08:00
CJ bf89063212 Support ~ in show git-ignore 2015-03-11 15:00:24 +08:00
spacewander b2c937e03a add wiki for git-merge-into 2015-03-11 14:47:08 +08:00
hemanth.hm 06a8f74f28 Merge pull request #323 from spacewander/master
add git-merge-into.
2015-03-11 10:05:32 +05:30
spacewander 46525fbfe8 add docs for git-merge-into 2015-03-10 23:50:09 +08:00
spacewander d94663312f add merge-into to merge two branches quickly 2015-03-10 23:45:00 +08:00
hemanth.hm d690268b43 Merge pull request #322 from andrewsomething/master
git-fresh-branch: Check for changes and prompt for input before nuking. (Issue: #142)
2015-03-10 08:14:39 +05:30
Andrew Starr-Bochicchio 28df09b103 git-fresh-branch: Check for changes and prompt for input before nuking. (Issue: #142) 2015-03-09 22:14:37 -04:00
hemanth.hm 14ef2a88ef Merge pull request #308 from spacewander/git-utility
extra mktemp into git_extra_mktemp.
2015-03-08 23:37:20 +05:30
hemanth.hm a48402153b Merge pull request #312 from RichardLitt/feature/concat-extra-feature-names
Added in option to concat extra feature names.
2015-03-08 23:36:41 +05:30
hemanth.hm 475124ac6e Merge pull request #320 from cironunes/gh-pages-fix
fix gh-pages to stash and don't delete files.
2015-03-03 18:12:02 +05:30
Ciro Nunes c1b0067a97 fix gh-pages to stash and don't delete files
Closes #137
2015-03-03 09:04:20 -03:00
hemanth.hm 30ac2ae550 Merge pull request #319 from pfctgeorge/allow-empty-when-setup
Allow empty initial commit when setup repo.
2015-02-20 10:21:35 +05:30
Jianjin Fan 6df9673936 Allow empty initial commit when setup repo.
When hit `git setup` in an empty directory, it doesn't create a commit. But often we need an empty initial commit for future rebasing and reseting, etc. Fixes #318.
2015-02-20 12:25:25 +08:00
hemanth.hm 722a4061ac Merge pull request #317 from jykntr/master
git-summary correctly displays project name.
2015-02-19 21:12:48 +05:30
jykntr bfeb897a6d git-summary correctly displays project name
git-summary correctly displays project name when not executed in the top
level directory of a repository.  Fixes tj/git-extras#302.

Uses the git-sh-setup script to find top level directory and then uses
that directory name for the project name.
2015-02-18 17:09:39 -07:00
chernjie 2a9ce31d25 git scp #300 2015-02-16 12:02:03 +08:00
hemanth.hm a618a56754 Merge pull request #316 from code42day/changelog-config
`changelog` config.
2015-02-16 09:23:21 +05:30
Damian Krzeminski fabb2c5541 changelog: add git-config support for format and log options
(1) make format configurable

you can change the default changelog format by configuring
changelog.format git variable

for example:

  git config changelog.format '- %s (%ae)'

gives you something like that:

  - Merge pull request #298 from timfeirg/master (hemanth.hm@gmail.com)
  - remove stuff from readme & form a list (kkcocogogo@gmail.com)

see git-log man for more examples

(2) make log options configurable

set `changelog.opts` to influence the way changelogs are generated

    git config changelog.opts --no-merges

or:

    git config changelog.opts --first-parent

fixes #285

also:
- delay calculating HEAD until needed
- remove extra line before header
2015-02-15 22:40:24 -05:00
hemanth.hm f12e7ac27c Merge pull request #315 from code42day/consistent-editor
use standard git editor in git-authors & git-changelog.
2015-02-14 16:41:04 +05:30
Damian Krzeminski a86d850688 use standard git editor in git-authors & git-changelog
The editor used will be chosen from the GIT_EDITOR environment variable,
the core.editor configuration variable, the VISUAL environment variable,
or the EDITOR environment variable (in that order).

That ensures that `git-changelog` and `git-authors` will use the same editor
as `git-commit`, `git-merge` etc.
2015-02-13 17:51:22 -05:00
hemanth.hm 8750491323 Merge pull request #314 from snowyu/feature/custom-commit-message
added custom commit message option to `git-release`
2015-02-12 19:11:34 +05:30
Riceball LEE 48eb195ee0 + custom commit message options supports 2015-02-12 17:55:31 +08:00
hemanth.hm 83b9348c91 Merge pull request #300 from chernjie/git-scp
git scp - Copy files to SSH compatible `git-remote`.
2015-02-11 13:47:01 +05:30
hemanth.hm f20e260a9a Merge pull request #313 from wooorm/bug/fix-missing-closing-brace
Fix missing closing curly brance in `bash_completion.sh`.
2015-02-11 13:46:00 +05:30
wooorm a58ee0a4e9 Fix missing closing curly brance in bash_completion.sh
- Introduced in b0a6d04f9ff303a9864070eda45c7309e3789ad4;
- Comments: https://github.com/tj/git-extras/commit/
  b0a6d04f9ff303a9864070eda45c7309e3789ad4#commitcomment-9687275.
2015-02-11 08:53:12 +01:00
Richard Littauer b1a790b851 Added in option to concat extra feature names
This takes any extra arguments supplied to `$git feature` and sets
them as the new feature name. For instances, instead of throwing an
error if `$git feature new thing` is called, it will create branch
`feature/new-thing`.
2015-02-10 16:02:39 -08:00
Ivan Malopinsky fc89e17a3c link to git delta 2015-02-10 00:03:09 -05:00
Ivan Malopinsky 30d2f07360 git delta usage 2015-02-09 23:54:54 -05:00
hemanth.hm ced7ec0c97 Merge pull request #310 from imsky/git-delta
Added `git-delta`.
2015-02-10 09:45:54 +05:30
Ivan Malopinsky e7b371b355 git-delta 2015-02-09 21:09:11 -05:00
Titus Wormer 0fd45396ce Add git-authors 2015-02-08 10:59:36 +01:00
hemanth.hm d4e40101f7 Merge pull request #309 from wooorm/feature/add-git-authors
Added `git-authors`.
2015-02-08 12:10:18 +05:30
wooorm b0a6d04f9f Add git-authors 2015-02-07 17:24:21 +01:00
Chris Hall cb2aa2792f Updated Commands (markdown) 2015-02-06 15:50:25 -05:00
Chris Hall ee543f184a Updated Commands (markdown) 2015-02-06 15:49:26 -05:00
Chris Hall 50650ec314 Updated Commands (markdown) 2015-02-06 15:48:40 -05:00
Chris Hall 104e953dd3 Updated Commands (markdown) 2015-02-06 15:48:20 -05:00
Chris Hall dae7399f7e Updated Commands (markdown) 2015-02-06 15:47:49 -05:00
CJ 0325c46a43 tj#300 Added bash completion 2015-02-05 18:23:37 +08:00
spacewander 32aee50bc6 extra mktemp into git_extra_mktemp
now we can put all utility functions to git-extra-utility
2015-02-05 14:22:49 +08:00
hemanth.hm c50f096ee3 Merge pull request #307 from ckhall/feature/add_git_chore_workflow
adding git-chore.
2015-02-05 11:21:15 +05:30
Chris Hall a36b7f4934 adding git-chore 2015-02-04 11:52:23 -05:00
hemanth.hm 4d07797b40 Merge pull request #306 from spacewander/master
add enough X to fix #303.
2015-02-02 20:05:39 +05:30
spacewander e1cedf7fd2 add enough X to fix #303.
GNU mktemp requires at least three X in the last part of template.
2015-02-02 21:35:44 +08:00
hemanth.hm c5c542da6c Merge pull request #304 from wooorm/git-ignore-typo
Fix typo in in `git ignore` message.
2015-01-23 18:27:36 +05:30
wooorm 1199186652 Fix typo in in git ignore message 2015-01-23 11:58:38 +01:00
CJ 195fb17458 symlink git-rscp to git-scp 2015-01-19 12:27:56 +08:00
hemanth.hm e738f760ae Avoid duplicating asterisk.
Closes https://github.com/tj/git-extras/pull/218
2015-01-18 22:10:39 +05:30
hemanth.hm a695f36f0b Updated License.
2015!
2015-01-01 00:07:00 +05:30
neydroid b99a6a0fed Fix link to git feature command 2014-12-28 13:48:35 -08:00
CJ 42fa7ceaac path argument can not be optional in rscp; add more docs 2014-12-29 00:14:44 +11:00
CJ 158266684d OMG a spelling mistake\! 2014-12-28 23:53:49 +11:00
hemanth.hm 13326b89e5 Merge pull request #301 from raeffs/master
updated documentation for git-squash.
2014-12-28 08:19:29 +05:30
Raphael Fleischlin bc17c1cb2e updated documentation because git-squash does no longer delete source-branch 2014-12-27 20:45:28 +01:00
CJ 909072ad54 Updated man page for git-scp 2014-12-18 15:45:35 +08:00
CJ 8259a0dcb4 First RFC documentation 2014-12-18 15:14:52 +08:00
hemanth.hm 182d17cd33 Merge pull request #299 from jonanp/git-delete-branch
Handle different remotes.
2014-12-17 17:49:02 +05:30
Jon Ander Peñalba bfd38ca891 When deleting a branch check if git has config.
Don't assume that the remote is always origin and that the
remote branch name is the same as the local one
2014-12-17 11:33:09 +01:00
hemanth af404cf6ae Added a footer. 2014-12-16 20:11:06 -08:00
hemanth.hm ce26630596 Merge pull request #298 from timfeirg/master
readme moved to wiki.
2014-12-17 09:37:56 +05:30
timfeirg dab6179163 remove stuff from readme & form a list 2014-12-17 11:32:47 +08:00
timfeirg f8a6252339 add a few keywords 2014-12-16 19:13:52 -08:00
timfeirg e300ddfdcc some remaining dashes 2014-12-16 07:51:42 -08:00
timfeirg 0f5985889b roughly finished 2014-12-16 07:39:26 -08:00
timfeirg 48f85b4039 Updated Commands (markdown) 2014-12-16 07:17:47 -08:00
timfeirg b46740bd33 Updated Commands (markdown) 2014-12-16 07:17:15 -08:00
timfeirg 67d48c7682 Updated Commands (markdown) 2014-12-16 07:16:59 -08:00
timfeirg 8585e0060d gonna use the clean sub command for each command explanation 2014-12-16 07:16:19 -08:00
timfeirg fdca066f90 adding links turn out to be a pain, go to sleep 2014-12-16 07:09:25 -08:00
timfeirg 866416b65e add commands page link 2014-12-16 07:07:13 -08:00
timfeirg fe618642eb add commands page, all copy & paste 2014-12-16 07:06:38 -08:00
timfeirg 15be9bb5ea add screencasts 2014-12-16 06:56:31 -08:00
timfeirg 1b514d3cbc copy from readme 2014-12-16 06:53:25 -08:00
timfeirg 77502c7908 Updated Install (markdown) 2014-12-16 06:50:40 -08:00
timfeirg fc08a9a165 Created Install (markdown) 2014-12-16 06:50:27 -08:00
CJ 73d5209743 adapted a more generic, customizable and friendly script 2014-12-16 21:26:18 +08:00
CJ 399073af7b Copy from git-goth https://github.com/chernjie/git-goth 2014-12-16 20:12:06 +08:00
timfeirg 93d58ec74a Initial Home page 2014-12-16 03:16:46 -08:00
hemanth.hm 1b2b61169a Merge pull request #296 from spacewander/add-completion
More bash completion functions.
2014-12-15 08:36:16 +05:30
spacewander 2f5a6c1399 add more bash completion functions 2014-12-14 17:17:01 +08:00
hemanth.hm fb573b2c4d Merge pull request #294 from GuillaumeSeren/feature/git-missing-add-ref-completion
Add ref completion to git-missing.
2014-12-12 23:27:58 +05:30
Guillaume Seren 903512c02b
Add ref completion to git-missing.
I find useful to get the ref completion in the git-missing command,
the behavior is the *like* the one on 'git log --pretty' it use the
'git for-each-ref' command to provide shortname of :
* All local branches.
* All remote/branches.
* All tags.
* The stash.

The output can be a bit huge, but provide a standard git / bash completion.
2014-12-12 18:52:07 +01:00
hemanth.hm a4c04f2c2b Merge pull request #293 from tj/revert-291-ignore-man-generated-files
Revert "Ignore *.html and *.1 auto-generated files in man/"
2014-12-12 17:34:56 +05:30
hemanth.hm 033ca547d5 Revert "Ignore *.html and *.1 auto-generated files in man/" 2014-12-12 17:34:41 +05:30
hemanth.hm b1614182fe Merge pull request #292 from RasmusWL/make-handle-missing-man
make will not assume man pages already exists.
2014-12-12 10:52:51 +05:30
Rasmus Wriedt Larsen fe3a781de0 make will not assume man pages already exists
They where removed from the repo by issue #291
2014-12-11 21:14:12 +01:00
hemanth.hm b1edc30cb4 Merge pull request #291 from jguenther/ignore-man-generated-files
Ignore *.html and *.1 auto-generated files in man/
2014-12-11 08:37:29 +05:30
Justin Guenther 70fd146eb1 Ignore man/git-*.html and man/git-*.1 2014-12-10 18:55:18 -06:00
Justin Guenther eb63d0bb1a Remove auto-generated files man/git-*.html and man/git-*.1 2014-12-10 18:54:40 -06:00
hemanth.hm 081e14f88f Merge pull request #226 from tsldh/master
Added changelog -c flag to git-release.
2014-12-07 10:49:24 +05:30
David Hartmann 292586d96f added changelog to release as optional flag
- rewrote the flags to contain multiple
- added -c as changelog option
2014-12-06 14:43:34 -05:00
hemanth.hm 5596354446 Merge pull request #289 from mavant/feature/mktemp
Use mktemp for temporary files.
2014-12-05 09:17:03 +05:30
Matthew Avant 7701ba4069 Use mktemp for temporary file creation. 2014-12-04 11:01:40 -08:00
hemanth.hm ec83f827b1 Merge pull request #288 from dead-horse/release-hook
made release hook more flexible.
2014-12-03 08:03:03 +05:30
dead-horse 9a9be49b63 make release hook more flexible 2014-12-03 00:57:41 +08:00
hemanth.hm fc726204e3 Merge pull request #287 from benjaminparnell/master
added --no-color to git-delete-merged-branches.
2014-12-01 15:55:43 +05:30
Ben Parnell 0b0b688c17 added --no-color to git-delete-merged-branches 2014-12-01 10:20:26 +00:00
hemanth.hm 7b7913fab1 More portable she-bangs. 2014-11-30 17:47:26 +05:30
hemanth.hm e7e6c96f3e Merge pull request #283 from e28eta/patch-1
Process-specific tmp file and clean up on exit.
2014-11-27 10:02:56 +05:30
Dan Jackson d7d6ff2fed Use process-specific tmp file and clean up on exit
Fixes #279 using the suggestion from @hemanth, with some minor tweaks:

- I kept the leading . because I figured there was a reason it was put there originally.
- Changed the show_cursor method that's called when the process exits (prematurely or naturally) to be show_cursor_and_cleanup, and added a line to it that cleans up the tmp file.
2014-11-26 10:23:54 -08:00
hemanth.hm 3770264901 Merge pull request #281 from emilkje/patch-1
Original repo remote is named 'upstream'.
2014-11-26 20:32:07 +05:30
hemanth.hm 48b4855502 Merge pull request #280 from valeriangalliat/feature/git-info-posix
git-info: POSIX compliance.
2014-11-26 20:30:22 +05:30
Emil Kjelsrud f51c38357f Update Readme.md
Original repo remote is named 'upstream' and not 'original' as Readme suggests.
2014-11-26 14:12:28 +01:00
Valérian Galliat 5ee706b585 git-info: POSIX compliance
Replace `echo -n` (non-POSIX) with an helper function `echon` echoing a
newline after given expression.
2014-11-26 14:02:29 +01:00
hemanth.hm e5585bd846 Merge pull request #278 from tj/delete-submodule-fix
Fixes #277.
2014-11-21 00:35:04 +05:30
hemanth.hm 53e4f3c89d Fixes #277 2014-11-21 00:31:43 +05:30
hemanth.hm e7990ed810 Merge pull request #276 from spacewander/master
git-ignore will cd root to find .gitignore.
2014-11-21 00:27:09 +05:30
Hemanth.HM cb0e56639c Version bump. 2014-11-18 21:37:03 +05:30
Hemanth.HM 421441aba1 Updated the list. 2014-11-18 21:34:21 +05:30
Hemanth.HM 52d0344269 Version 2.2.0 2014-11-18 21:33:20 +05:30
hemanth.hm e807967655 Merge pull request #275 from spacewander/master
Update `mktemp` command to work on Mac OS X.
2014-11-18 21:07:16 +05:30
spacewander 0374044790 modify the behavior of git-ignore, now it will cd root to find .gitignore 2014-11-17 21:36:56 +08:00
spacewander 67241a46a8 Update mktemp command to work on Mac OS X
Fix issue 274. It seens like the same with
[this issue](https://github.com/StanAngeloff/lotte/issues/1).
2014-11-13 22:13:13 +08:00
hemanth.hm 9074608bd8 Merge pull request #273 from spacewander/master
'git root' shows the path to root of repo.
2014-11-13 17:57:13 +05:30
spacewander 92c34e8e00 add new command 'git root' to show the path to root of repo 2014-11-13 16:12:50 +08:00
hemanth.hm 1748fb29c5 Merge pull request #271 from bohnman/git-rename-tag-fix
tag to tags
2014-11-08 11:14:59 +05:30
hemanth.hm 89e728f78a Merge pull request #272 from spacewander/master
replace visionmedia/git-extras to tj/git-extras
2014-11-08 11:12:52 +05:30
spacewander f0e0322923 correct the format of git-rebase-patch.md. Now we can handle it with script
Also regeneralize all markdown documents.
2014-11-06 21:35:17 +08:00
spacewander 0a3bc99d9a correct the '-m' argument for grep. Then regenralize git-extra
'-m' option is supported both in GNU grep and in BSD grep
GNU grep: <http://linux.die.net/man/1/grep>
BSD grep:
<https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/grep.1.html>
2014-11-06 21:33:14 +08:00
spacewander 76e0dfef97 replace visionmedia/git-extras to tj/git-extras
Although Github reserves the 'visionmedia' user space(a visit to there
will be redirected to 'tj'), it's better to
rename the links from visionmedia/git-extras to tj/git-extras
2014-11-06 17:12:01 +08:00
Ryan Bohn 53efa98c15 changing incorrect reference of tag to tags 2014-11-05 15:29:48 -05:00
hemanth.hm 2f59bdfe91 Merge pull request #270 from kevinawoo/hotfix/git-locked
git-locked
2014-10-17 07:31:35 +05:30
Kevin Woo 6d7f10c0c6 added git-locked to check what files have been locked 2014-10-16 20:53:47 -05:00
hemanth.hm 55c8ad0141 Merge pull request #268 from GuillaumeSeren/bug/git-missing
Fix #267, git-missing did not catch branch name.
2014-10-15 08:02:04 +05:30
Guillaume Seren db0f610bc1
Fix #267, git-missing did not catch branch name.
It was a bug on my setup, the test did no detect the
branch name, so I change:
if [[ $arg != -* ]]; then
by
if [ -n "${arg}" ]; then

According to test man page, -n:
«True if the length of string is non-zero.»

I also added quote and {} around the param,
to prevent bash expension around strange char.
2014-10-14 16:24:18 +02:00
376 changed files with 25809 additions and 3067 deletions

30
.editorconfig Normal file
View file

@ -0,0 +1,30 @@
root = true
[*]
indent_style = space
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[Makefile]
indent_style = tab
[*.patch]
trim_trailing_whitespace = false
[*.md]
trim_trailing_whitespace = false
[*.html]
trim_trailing_whitespace = false
[*.py]
indent_size = 4
[*.bats]
indent_style = tab
indent_size = 4
[tests/*.sh]
indent_style = tab
indent_size = 4

2
.github/.ignore_words vendored Normal file
View file

@ -0,0 +1,2 @@
gool
Cant

12
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,12 @@
<!--
Note
* Mark the PR as draft until it's ready to be reviewed.
* Please update the documentation to reflect the changes made in the PR.
* If the command is covered by tests under ./tests, please add/update tests for any changes unless you have a good reason.
* Make a new commit to resolve conversations instead of `push -f`.
* To resolve merge conflicts, merge from the `main` branch instead of rebasing over `main`.
* Please wait for the reviewer to mark a conversation as resolved.
-->

6
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

116
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,116 @@
name: ci
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Check out code.
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: 'Get Changed Files'
id: 'files'
run: |
CHANGED_FILES=$(git diff --name-only "${BASE_SHA:-$BEFORE_SHA}...${HEAD_SHA:-$GITHUB_REF}")
echo "::notice::Changed files: $CHANGED_FILES"
{
echo "added_modified<<EOF"
echo "$CHANGED_FILES"
echo "EOF"
} >> "$GITHUB_OUTPUT"
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
BEFORE_SHA: "${{ github.event.before }}"
- name: 'Check Generated Manuals'
run: |
failed=0
while IFS= read -r source; do
case "$source" in
man/git-*.md)
stem=${source%.md}
for generated in "$stem.1" "$stem.html"; do
if ! grep -Fqx -- "$generated" <<< "$CHANGED_FILES"; then
echo "::error file=$source::$generated must be updated with $source"
failed=1
fi
done
;;
esac
done <<< "$CHANGED_FILES"
exit "$failed"
env:
CHANGED_FILES: "${{ steps.files.outputs.added_modified }}"
- uses: 'actions/setup-go@v7'
with:
go-version: '1.20'
- name: 'Install EditorConfig Lint'
run: go install 'github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@latest'
- name: 'Check EditorConfig Lint'
run: echo "$FILES" | xargs ~/go/bin/editorconfig-checker
env:
# NOTE: use env to pass the output in order to avoid possible injection attacks
FILES: "${{ steps.files.outputs.added_modified }}"
- name: checkstyle
run: ./scripts/checkstyle.py
- name: Shellcheck
run: shellcheck --severity=error bin/* ./*.sh
typo:
runs-on: ubuntu-latest
steps:
- name: Check out code.
uses: actions/checkout@v7
- name: Install codespell
run: python3 -m pip install codespell==2.4
- name: spell check
run: |
git grep --cached -l '' . | \
grep -v -e 'History\.md' -e 'AUTHORS' -e 'man/.*\.1' -e 'man/.*\.html' | \
xargs codespell --ignore-words=.github/.ignore_words
test-bats:
name: 'Test with Bats'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- name: Setup Bats
id: setup-bats
uses: bats-core/bats-action@4.0.0
with:
bats-version: 'v1.8.1'
- name: Test with Bats
env:
BATS_LIB_PATH: ${{ steps.setup-bats.outputs.lib-path }}
TERM: xterm
run: bats ./tests
build:
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.platform }}
steps:
- name: Check out code.
uses: actions/checkout@v7
- name: Linux Install
if: matrix.platform == 'ubuntu-latest'
run: sudo apt-get install -y bsdmainutils
- name: Script
run: ./check_integrity.sh
- name: Brew release
if: matrix.platform == 'macos-latest'
run: |
mkdir ../release && git archive --format=tar.gz HEAD > ../release/git-extras-release.tar.gz
cd ../release
tar -xzf git-extras-release.tar.gz && make PREFIX=$(pwd) INSTALL_VIA=brew
./bin/git-extras update | grep "brew upgrade git-extras"

18
.github/workflows/stale.yaml vendored Normal file
View file

@ -0,0 +1,18 @@
name: "Maintenance: Close Stale PRs"
on:
schedule:
- cron: "30 1 * * *"
permissions:
pull-requests: "write"
jobs:
stale:
runs-on: "ubuntu-latest"
if: github.repository_owner == 'tj'
steps:
- uses: "actions/stale@v11"
with:
close-pr-message: "This PR was closed because it has been stalled for 365 days with no activity. Feel free to make a new PR if you wish to continue"
days-before-pr-stale: 350
days-before-pr-close: 15

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
.venv/
__pycache__/
coverage/

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "vendor/bats-all"]
path = vendor/bats-all
url = https://github.com/hyperupcall/bats-all

5
.pytest.ini Normal file
View file

@ -0,0 +1,5 @@
[pytest]
minversion = 7.4
addopts = -ra -q
testpaths = tests
faulthandler_timeout = 5

306
AUTHORS
View file

@ -1,26 +1,296 @@
git-extras is written and maintained by TJ Holowaychuk and
various contributors:
Development Lead
````````````````
git-extras is written and maintained by various contributors:
Maintainers
```````````
- TJ Holowaychuk <tj@vision-media.ca>
- Hemanth.HM <hemanth.hm@gmail.com>
- Nimit Kalra <me@nimit.io>
- Nicolai Skogheim <nicolai.skogheim@gmail.com>
- spacewander <spacewanderlzx@gmail.com>
- Edwin Kofler <edwin@kofler.dev>
- Leroy <vanpipy@gmail.com>
Patches and Suggestions
```````````````````````
- Kenneth Reitz
- Aggelos Orfanakos
- Jonathan "Duke" Leto
- Domenico Rotiroti
- Jason Young
- Nick Campbell
- Jonhnny Weslley
- Alex McHale
- Gert Van Gool
- Devin Withers
- David Baumgold
- Tobias Fendin
- LeeW
- timfeirg
- Niklas Schlimm
- nickl-
- CJ
- Paul Wise
- Damien Tardy-Panis
- Mark Eissler
- Yuriy VG
- Leila Muhtasib
- Duane Johnson
- Todd Wolfson
- Richard Fearn
- Bill Wood
- Jesús Espino
- Rémy HUBSCHER
- go2null
- Andrew Janke
- David Baumgold
- Jan Schulz
- Kenneth Reitz
- Mark Pitman
- Peter Benjamin
- Günther Grill
- Luke Childs
- Sasha Khamkov
- equt
- oikarinen
- vyas
- Don Harper
- Pierre Ayoub
- Robin Winslow
- Ross Smith II
- Yi EungJun
- grindhold
- wyattscarpenter
- Aggelos Orfanakos
- Camille Reynders
- Carlos Prado
- Chris Hall
- Damian Krzeminski
- NANRI
- Alexander Krasnukhin
- Phally
- Rico Sta. Cruz
- Takuma Yamaguchi
- thomas menzel
- vr8ce
- Brian J Brennan
- Dominik Gedon
- Hogan Long
- Ivan Malopinsky
- John Bachir
- Jonathan "Duke" Leto
- Julio Napurí
- Justin Dugger
- Nils Winkler
- Philipp Klose
- Raphael Boidol
- Richard Russon
- Sam Bostock
- Vladimir Jimenez
- gisphm
- jacobherrington
- overengineer
- phigoro
- wooorm
- Alexis GRIMALDI
- Allan Odgaard
- Andre Cerqueira
- Austin Ziegler
- Beth Skurrie
- Brice Dutheil
- Curtis McEnroe
- Daniele Paolella
- David Rogers
- Devin Withers
- Domenico Rotiroti
- Evan Grim
- Florian H
- Gert Van Gool
- Guillaume Seren
- Hozefa
- Igor Ostapenko
- Jean Jordaan
- Joshua Li
- Justin Guenther
- Kylie McClain
- Marc Harter
- Matiss
- Nate Jones
- Newell Zhu
- Patryk Małek
- Paul Schreiber
- Richard Littauer
- Tjaart van der Walt
- Tom Vincent
- Wil Moore III
- William Montgomery
- Ye Lin Aung
- luozexuan
- roxchgt
- soffolk
- 0xflotus
- Abdullah
- Adam Parkin
- Adriaan Zonnenberg
- Akim Demaille
- Alessandro Pagiaro
- Alex McHale
- Aloxaf
- Amir Tocker
- Ammar Najjar
- Amory Meltzer
- Andreas Duering
- Andrei Petcu
- Andrew Griffiths
- Andrew Marcinkevičius
- Andrew Starr-Bochicchio
- Andrew Sullivan Cant
- Andrey Elizarov
- Angel Aguilera
- Antoine Beaupré
- Aurélien Scoubeau
- Balazs Nadasdi
- Ben Parnell
- Beni Ben Zikry
- Brandon Zylstra
- Brian Goad
- Brian Murrell
- Bruno Sutic
- Caleb Maclennan
- Carl Casbolt
- Carlos Rodríguez
- Christophe Badoit
- Ciro Nunes
- CleanMachine1
- CodeByZach
- Craig MacGregor
- Dan Goodliffe
- Dan Jackson
- Dan Kilman
- Daniel Bruder
- Daniel Lublin
- Daniel Schildt
- Dave James Miller
- David Hartmann
- Dominic Barnes
- Dung Quang
- Edward Betts
- Eli Schwartz
- Emil Kjelsrud
- Erik Skultety
- François M
- George Crabtree
- Gerrit-K
- Greg Allen
- Guilhem Saurel
- Guillermo Rauch
- Gunnlaugur Thor Briem
- Hasse Ramlev Hansen
- Heiko Becker
- Hugo Ruiz-Mireles
- Isaac Mungai
- J.C. Yamokoski
- Jack O. Wasey
- James Manning
- James Zhu
- Jan Krueger
- Jared Baur
- Jarod Stewart
- Jason Young
- Jens K. Mueller
- Jeremy Lin
- Jesse Sipprell
- Jianjin Fan
- Jobin Kurian
- Johannes Ewald
- John Evans
- John Hoffmann
- Jon Ander Peñalba
- Josh McKinney
- Joshua Appelman
- José María Gutiérrez @TheTechOddBug
- Katrin Leinweber
- Kevin Woo
- Konstantin Schukraft
- Kurban Mallachiev
- Leandro López
- Lone
- Luis Miguel Hernanz
- Maarten Winter
- Marco Glasbergen
- Matan Rosenberg
- Mathieu D. (MatToufoutu)
- Matt
- Matt Colyer
- Matt Headley
- Matthew Avant
- Mattias Andersson
- Michael Komitee
- Michael Matuzak
- Michele Bologna
- Montak Oleg
- Moritz Grauel
- Nate Eagleson
- Nate Fischer
- Nathan Rajlich
- Nick Campbell
- Nick Payne
- Nicolas Kosinski
- Niklas Fiekas
- Oliver Kopp
- Orestis
- Peter Bittner
- Piotr Górski
- Prayag Verma
- Przemek Kitszel
- R. Martinho Fernandes
- Raphael Fleischlin
- Rasmus Wriedt Larsen
- René
- Revisor
- Ricardo Fernández Serrata
- Riceball LEE
- Rob Kennedy
- Robin von Bülow
- Russ
- Ryan Bohn
- Sachin Gupta
- Sam Thursfield
- Sandro
- Sascha Andres
- SchleimKeim
- Sean Molenaar
- Sebastian Gniazdowski
- Sebastián Mancilla
- Simon Tate
- Stefan VanBuren
- Stephen Mathieson
- Steve Mao
- Stu Feldt
- SukkaW
- Tim Preston
- Timothy Hwang
- Tin Lai
- Todd Wolfson
- Tom Andrade
- Tom Ashworth
- Tony
- TweeKane
- Valérian Galliat
- Vitaly Chikunov
- Wei Lee
- Wei Wu
- Wen Sun
- Wiktor Żurawik
- Xavier Krantz
- Xiaopei Li
- Zeeshan Ahmed
- ax1036
- creynders
- dead-horse
- eszabpt
- fengkx
- johnpyp
- jykntr
- kang
- meza
- neydroid
- nulltask
- phanium
- sgleizes
- tfendin
- tiemonl
- zentarul
- zeroDivisible
- zhiyanfoo
- Áron Hoffmann
- Étienne BERSAC
- ☃ pitr
- 单元源

34
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,34 @@
# Contributing
Thanks for contributing! Please read this document before you make a PR.
## Supported Platforms
Any changes must support the following platforms:
- macOS
- Linux
- OpenBSD (You may need to browse their man page)
Your change must also be compatible with the dependency constraints that we specify in [Installation](./Installation.md). If you aren't sure if a feature is compatible, check the manual or release notes. For example, the Bash changelog is [here](https://git.savannah.gnu.org/cgit/bash.git/tree/NEWS?h=devel).
If you aren't able to test your new command on a platform, make that clear in your PR; someone else may be able to test it on their system.
## Adding a New Command
Let's say you wish to add a new command. Assuming your new command is named `foo`:
1. Write a bash script under `./bin` called `git-foo`. The script should be started with `#!/usr/bin/env bash`.
2. Read `./man/Readme.md` and write documentation for `git-foo`.
3. Don't forget to introduce it in `Commands.md`.
4. Update `./etc/git-extras-completion.zsh`. Just follow existing code.
5. (Optional) Update `./etc/bash_completion.sh`.
6. (Optional) Update `./etc/git-extras.fish`.
7. (Optional) Add a test under `./tests`.
8. Run `./check_integrity.sh foo` to check if all done. (You may also run `./check_integrity.sh` to check all commands.)
You are welcome to open up an issue to discuss new commands or features before opening a pull request.
## Submitting a pull request
Please follow the suggestion in `./.github/PULL_REQUEST_TEMPLATE.md`.

1729
Commands.md Normal file

File diff suppressed because it is too large Load diff

1384
History.md

File diff suppressed because it is too large Load diff

196
Installation.md Normal file
View file

@ -0,0 +1,196 @@
# Installation
## Dependencies
Some commands require extra dependencies which are unavailable in some platforms.
You may need to install them manually. They are:
* bash 4.0+
* Git 2.17+
* `column`
* `awk`
* `find`
* `tput`
* cURL (only required for `git-fork`, `git-ignore-io`, `git-pull-request`)
* `ps` (only required for `git-changelog`)
* `rsync` (only required for `git-rscp`, `git-scp`)
* `xargs` (only required for `git-delete-merged-branches`, `git-force-clone`, `git-sed`, `git-scp`)
If `bash --version` shows a lower version, you need to update it.
For example, the default bash in Mac is usually too old and you may need to update it via `brew install bash`.
## Installing with a package manager
Note that only the Homebrew package is maintained by the git-extras developers directly.
Other packages are maintained by the distribution's packagers or third-party volunteers.
[![Packaging status](https://repology.org/badge/vertical-allrepos/git-extras.svg)](https://repology.org/project/git-extras/versions)
### Debian
```bash
$ sudo $apt_pref update
$ sudo $apt_pref install git-extras
```
### Fedora
```bash
$ sudo dnf install git-extras
```
### openSUSE
Substitute your openSUSE version in the command below (in this case we are considering openSUSE Leap 15.6):
```bash
$ sudo zypper ar https://download.opensuse.org/repositories/devel:/tools:/scm/15.6/devel:tools:scm.repo
```
and install it:
```bash
$ sudo zypper in -y git-extras
```
### RHEL/CentOS (requires [EPEL](https://fedoraproject.org/wiki/EPEL))
```bash
$ sudo yum install git-extras
```
### Ubuntu
```bash
$ sudo apt-get install git-extras
```
### Nix/NixOS
```bash
$ nix-env -i git-extras
```
### CRUX
[Abdullah](https://github.com/AWAN) has written a [Pkgfile](https://abdullah.today/ports/git-extras/Pkgfile) for his beloved [distro](https://crux.nu).
### Homebrew
```bash
$ brew install git-extras
```
Installing from Homebrew will not give you the option omit certain `git-extras` if they conflict with existing git aliases. To have this option, build from source.
### Arch Linux
* [git-extras](https://aur.archlinux.org/packages/git-extras/)
* [git-extras-git](https://aur.archlinux.org/packages/git-extras-git/)
### Windows
First, please install `Git for Windows 2.x` from 'https://github.com/git-for-windows/git/releases'.
Second, clone the `git-extras` repo into any folder you like.
```bash
git clone https://github.com/tj/git-extras.git
# checkout the latest tag (optional)
git checkout $(git describe --tags $(git rev-list --tags --max-count=1))
```
After that, execute the `install.cmd` in the command prompt. If you installed
git as admin, you need to run this prompt as admin, too. Per default, it finds
a `Git for Windows 2.x` if it's in the path (first path in `where git.exe` wins)
or installed in the default location `%ProgramFiles%\Git`. The fallback is
`C:\SCM\PortableGit`. If you didn't install git into one of these dirs, you have
to supply the path for the install location, e.g. if git is installed
in `c:\git`:
```batch
install.cmd "C:\git"
```
Last, to use `git summary` and `git ignore-io`, you need to copy
`column.exe` from a [msys2][1] installation from `folder-your-msys2-installed/usr/bin`
to `folder-your-git-installed/usr/bin` or wait for git 2.7.1, which will include column.exe.
### FreeBSD
```bash
$ pkg install git-extras
```
### BSD
Use the instructions to build from source below. Make sure you are using `gmake` (GNU `make`) instead of `make`.
## Building from source
Read [Dependencies](#dependencies) and ensure they are installed.
Obtain the git-extras source by cloning [its GitHub repo](https://github.com/tj/git-extras.git) or downloading a tarball of a [release](https://github.com/tj/git-extras/releases). Then install it by doing `make install` from the source tree.
```bash
$ git clone https://github.com/tj/git-extras.git
$ cd git-extras
# checkout the latest tag
$ git checkout $(git describe --tags $(git rev-list --tags --max-count=1))
$ [sudo] make install
```
By default, git-extras is installed under `/usr/local`. To install it at an
alternate location, specify a `PREFIX` when calling `make`.
```bash
# Non-root users can install under their home directory
make install PREFIX=$HOME/.local
# For third-party software kept under /opt
make install PREFIX=/opt
```
If you want to relocate the bulk of the installation but still have configuration
files installed to the system `/etc` dir or other alternate location, you can
specify `SYSCONFDIR` in addition to `PREFIX`.
```sh
$ sudo make install PREFIX=/usr/local SYSCONFDIR=/etc
```
See the Makefile for details on advanced configuration options.
## Installing from network
One-liner:
```bash
curl -sSL https://raw.githubusercontent.com/tj/git-extras/main/install.sh | sudo bash /dev/stdin
```
## Installing as Zsh plugin
[ZInit](https://github.com/zdharma/zinit) can install git-extras by using:
```zsh
zinit ice as"program" pick"$ZPFX/bin/git-*" src"etc/git-extras-completion.zsh" make"PREFIX=$ZPFX"
zinit light tj/git-extras
# or with the for syntax + async load
zinit lucid wait'0a' for \
as"program" pick"$ZPFX/bin/git-*" src"etc/git-extras-completion.zsh" make"PREFIX=$ZPFX" tj/git-extras
```
`$ZPFX` is `~/.zinit/polaris` by default. Use `zinit update tj/git-extras` to update.
This method installs in `$HOME`, so you don't need to ask administrator to install package.
## Updating
If you installed git-extras with a package manager, use that package manager's tools to update it.
If you installed git-extras from source, you can run `git-extras update` to update it to the latest release. Be aware that this may lose any configuration options you specified during the original installation.
Enjoy `git-extras`!
[1]: https://sourceforge.net/projects/msys2/

View file

@ -1,6 +1,6 @@
(The MIT License)
Copyright (c) 2010-2011 TJ Holowaychuk <tj@vision-media.ca>
Copyright (c) 2010 TJ Holowaychuk <tj@vision-media.ca> and Contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

129
Makefile
View file

@ -1,40 +1,116 @@
PREFIX ?= /usr/local
BINPREFIX ?= "$(PREFIX)/bin"
MANPREFIX ?= "$(PREFIX)/share/man/man1"
SYSCONFDIR ?= $(PREFIX)/etc
SHELL := bash
OS = $(shell uname)
ifeq ($(OS), FreeBSD)
MANPREFIX ?= "$(PREFIX)/man/man1"
ifeq ($(MANPREFIX), /usr/local)
MANPREFIX = "/usr/local/man/man1"
endif
else
MANPREFIX ?= "$(PREFIX)/share/man/man1"
endif
ifeq ($(OS), Darwin)
COMPL_DIR ?= "$(DESTDIR)$(SYSCONFDIR)/bash_completion.d"
else ifeq ($(OS), FreeBSD)
COMPL_DIR ?= "$(DESTDIR)$(SYSCONFDIR)/bash_completion.d"
else
COMPL_DIR ?= "$(DESTDIR)$(SYSCONFDIR)/bash-completion/completions"
endif
BINS = $(wildcard bin/git-*)
MANS = $(wildcard man/git-*.md)
MAN_BINS = $(filter-out man/git-extras.md, $(MANS))
MAN_HTML = $(MANS:.md=.html)
MAN_PAGES = $(MANS:.md=.1)
CODE_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
INSTALL_VIA ?= source
# Libraries used by all commands
LIB = "helper/reset-env" "helper/git-extra-utility"
COMMANDS_USED_WITHOUT_GIT_REPO = git-alias git-extras git-fork git-setup
COMMANDS_USED_WITH_GIT_REPO = $(filter-out $(COMMANDS_USED_WITHOUT_GIT_REPO), \
$(subst bin/, , $(BINS)))
COMMANDS = $(subst bin/, , $(BINS))
default: install
docs: $(MAN_HTML) $(MAN_PAGES)
install:
@mkdir -p $(DESTDIR)$(MANPREFIX)
@mkdir -p $(DESTDIR)$(BINPREFIX)
@echo "... installing bins to $(DESTDIR)$(BINPREFIX)"
@echo "... installing man pages to $(DESTDIR)$(MANPREFIX)"
$(eval TEMPFILE := $(shell mktemp))
check:
@echo "Check dependencies before installation"
@./check_dependencies.sh
@echo
install: check
@if [ "$(INSTALL_VIA)" = brew ]; then \
git apply brew-release.patch || { echo "Can't apply brew release patch"; exit 1; } \
fi
mkdir -p $(DESTDIR)$(MANPREFIX)
mkdir -p $(DESTDIR)$(BINPREFIX)
@echo '... installing bins to '$(DESTDIR)$(BINPREFIX)
@echo '... installing man pages to '$(DESTDIR)$(MANPREFIX)
$(eval TEMPFILE := $(shell mktemp -q $${TMPDIR:-/tmp}/git-extras.XXXXXX 2>/dev/null || mktemp -q))
@# chmod from rw-------(default) to rwxrwxr-x, so that users can exec the scripts
@chmod 775 $(TEMPFILE)
@$(foreach COMMAND, $(COMMANDS_USED_WITH_GIT_REPO), \
echo "... installing $(COMMAND)"; \
head -1 bin/$(COMMAND) | cat - ./helper/is-git-repo > $(TEMPFILE); \
tail -n +2 bin/$(COMMAND) >> $(TEMPFILE); \
cp -f $(TEMPFILE) $(DESTDIR)$(BINPREFIX)/$(COMMAND); \
$(eval EXISTED_ALIASES := $(shell \
git config --get-regexp 'alias\..*' | awk '{print "git-" substr($$1, 7)}'))
@$(foreach COMMAND, $(COMMANDS), \
should_install='yes'; \
if [ ! -z "$(filter $(COMMAND), $(EXISTED_ALIASES))" ] && [ "$$SKIP_CONFLICT_CHECK" != yes ]; then \
read -p "$(COMMAND) conflicts with an alias, still install it? [y/n]: " answer; \
if [ "$$answer" = 'n' ] || [ "$$answer" = 'N' ]; then \
should_install="no"; \
fi; \
fi; \
if [ "$$should_install" = 'yes' ]; then \
echo "... installing $(COMMAND)"; \
head -1 bin/$(COMMAND) > $(TEMPFILE); \
cat $(LIB) >> $(TEMPFILE); \
if ! grep "$(COMMAND)" not_need_git_repo >/dev/null; then \
cat ./helper/is-git-repo >> $(TEMPFILE); \
fi; \
if grep "$(COMMAND)" need_git_commit >/dev/null; then \
cat ./helper/has-git-commit >> $(TEMPFILE); \
fi; \
tail -n +2 bin/$(COMMAND) >> $(TEMPFILE); \
cp -f $(TEMPFILE) $(DESTDIR)$(BINPREFIX)/$(COMMAND); \
fi; \
)
@$(foreach COMMAND, $(COMMANDS_USED_WITHOUT_GIT_REPO), \
echo "... installing $(COMMAND)"; \
cp -f bin/$(COMMAND) $(DESTDIR)$(BINPREFIX); \
)
cp -f man/git-*.1 $(DESTDIR)$(MANPREFIX)
@mkdir -p $(DESTDIR)/etc/bash_completion.d
cp -f etc/bash_completion.sh $(DESTDIR)/etc/bash_completion.d/git-extras
@if [ -z "$(wildcard man/git-*.1)" ]; then \
echo "WARNING: man pages not created, use 'make docs' (which requires 'ronn' ruby lib)"; \
else \
cp -f man/git-*.1 $(DESTDIR)$(MANPREFIX); \
echo "cp -f man/git-*.1 $(DESTDIR)$(MANPREFIX)"; \
fi
@mkdir -p $(COMPL_DIR)
cp -f etc/bash_completion.sh $(COMPL_DIR)/git-extras
@echo ""
@echo "If you are a zsh user, you may want to 'source $(CODE_DIR)etc/git-extras-completion.zsh'" \
"and put this line into ~/.zshrc to enable zsh completion"
@echo "If you are a fish user, you may want to copy or link '$(CODE_DIR)etc/git-extras.fish'" \
"to '~/.config/fish/completions/'"
man/%.html: man/%.md
man/index.txt: $(MANS)
echo '# manuals' > $@.tmp
for file in $(sort $^) ; do \
extra=$${file%.md} ; \
extra=$${extra#man/} ; \
echo "$$extra(1) $$extra" >> $@.tmp ; \
done
mv -f $@.tmp $@
man/git-extras.md: $(MAN_BINS)
ln=$$(awk '/## COMMANDS/{print NR};' $@) ; \
awk "NR <= $$ln+1" $@ > $@.tmp
for file in $(sort $^) ; do \
head -n1 $$file | \
sed 's/^/ - **/;s/ -- /** /' >> $@.tmp ; \
done
ln=$$(awk '/## AUTHOR/{print NR};' $@) ; \
awk "NR >= $$ln-1" $@ >> $@.tmp
mv -f $@.tmp $@
man/%.html: man/%.md man/index.txt
ronn \
--manual "Git Extras" \
--html \
@ -56,7 +132,7 @@ uninstall:
echo "... uninstalling $(DESTDIR)$(MANPREFIX)/$(notdir $(MAN))"; \
rm -f $(DESTDIR)$(MANPREFIX)/$(notdir $(MAN)); \
)
rm -f $(DESTDIR)/etc/bash_completion.d/git-extras
rm -f $(COMPL_DIR)/git-extras
clean: docclean
@ -64,4 +140,7 @@ docclean:
rm -f man/*.1
rm -f man/*.html
.PHONY: docs clean docclean install uninstall
test:
bats ./tests
.PHONY: default docs check install uninstall clean docclean test

680
Readme.md
View file

@ -2,681 +2,33 @@
Little git extras.
## Installation
Clone / Tarball:
```bash
$ make install
```
One-liner:
```bash
$ (cd /tmp && git clone --depth 1 https://github.com/visionmedia/git-extras.git && cd git-extras && sudo make install)
```
[MacPorts](http://www.macports.org/)
```bash
$ sudo port install git-extras
```
[Brew](http://brew.sh/):
```bash
$ brew install git-extras
```
## Screencasts
Just getting started? Check out these screencasts:
Just getting started? Check out these screencasts:
- [introduction](https://vimeo.com/45506445) -- covering git-ignore, git-setup, git-changelog, git-release, git-effort and more
* [introduction](https://vimeo.com/45506445) ([archive.org link](https://web.archive.org/web/20230219181235id_/vod-progressive.akamaized.net/exp=1676834145~acl=%2Fvimeo-prod-skyfire-std-us%2F01%2F4101%2F1%2F45506445%2F107111328.mp4~hmac=065b68f23c4b6a222463097b36d1c346995a9559baa9b819972da95550018471/vimeo-prod-skyfire-std-us/01/4101/1/45506445/107111328.mp4)) -- covers `git-ignore`, `git-setup`, `git-changelog`, `git-release`, `git-effort` and more
## Installation
See the [Installation](Installation.md) page.
## Commands
- `git extras`
- `git squash`
- `git summary`
- `git effort`
- `git changelog`
- `git commits-since`
- `git count`
- `git create-branch`
- `git delete-branch`
- `git delete-submodule`
- `git delete-tag`
- `git delete-merged-branches`
- `git fresh-branch`
- `git graft`
- `git alias`
- `git ignore`
- `git info`
- `git fork`
- `git release`
- `git contrib`
- `git repl`
- `git undo`
- `git gh-pages`
- `git setup`
- `git touch`
- `git obliterate`
- `git feature`
- `git refactor`
- `git bug`
- `git local-commits`
- `git archive-file`
- `git missing`
- `git lock`
- `git unlock`
- `git reset-file`
- `git pr`
Go to the [Commands](Commands.md) page for basic usage and examples.
## git-extras
__GIT utilities__ -- repo summary, repl, changelog population, author commit percentages and more
The main `git-extras` command.
## Contributing
Output the current `--version`:
Interested in contributing? Awesome!
```bash
$ git extras
```
Please read [Contributing](CONTRIBUTING.md) before you make a PR, thanks!
List available commands:
## The change of the default branch
```bash
$ git extras --help
```
As of Git Extras 6.4 the assumed default branch name changed from `master` to `main`.
This affects the Git Extras commands `git archive-file`, `git delete-merged-branches`, `git delta`, `git pull-request`, `git show-merged-branches`, `git show-unmerged-branches`, and `git squash`.
Update to the latest `git-extras`:
To change the default branch name to `master`: change either the configuration `git-extras.default-branch` or `init.defaultBranch` to `master`; the former takes precedence.
```bash
$ git extras update
```
## git-gh-pages
Sets up the `gh-pages` branch. (See [GitHub Pages](http://pages.github.com/) documentation.)
## git-[feature|refactor|bug] [finish] &lt;name&gt;
Create the given feature, refactor, or bug branch `name`:
```bash
$ git feature dependencies
```
Afterwards, the same command will check it out:
```bash
$ git checkout master
$ git feature dependencies
```
When finished, we can `feature finish` to merge it into the current branch:
```bash
$ git checkout master
$ git feature finish dependencies
```
All of this works with `feature`, `bug`, or `refactor`.
## git-contrib &lt;author&gt;
Output `author`'s contributions to a project:
```bash
$ git contrib visionmedia
visionmedia (18):
Export STATUS_CODES
Replaced several Array.prototype.slice.call() calls with Array.prototype.unshift.call()
Moved help msg to node-repl
Added multiple arg support for sys.puts(), print(), etc.
Fix stack output on socket error
...
```
## git-summary
Outputs a repo summary:
```bash
$ git summary
project : git-extras
repo age : 10 months ago
commits : 163
active : 60 days
files : 93
authors :
97 Tj Holowaychuk 59.5%
37 Jonhnny Weslley 22.7%
8 Kenneth Reitz 4.9%
5 Aggelos Orfanakos 3.1%
3 Jonathan "Duke" Leto 1.8%
2 Gert Van Gool 1.2%
2 Domenico Rotiroti 1.2%
2 Devin Withers 1.2%
2 TJ Holowaychuk 1.2%
1 Nick Campbell 0.6%
1 Alex McHale 0.6%
1 Jason Young 0.6%
1 Jens K. Mueller 0.6%
1 Guillermo Rauch 0.6%
```
This command can also take a *commitish*, and will print a summary for commits in
the commmitish range:
```bash
$ git summary v42..
```
This command can also take an options `--line`, will print a summary by lines
```bash
$ git summary --line
project : git-extras
lines : 8420
authors :
2905 Tj Holowaychuk 34.5%
1901 Jonhnny Weslley 22.6%
1474 nickl- 17.5%
653 Leila Muhtasib 7.8%
275 Tony 3.3%
267 Jesús Espino 3.2%
199 Philipp Klose 2.4%
180 Michael Komitee 2.1%
178 Tom Vincent 2.1%
119 TJ Holowaychuk 1.4%
114 Damian Krzeminski 1.4%
66 Kenneth Reitz 0.8%
22 Not Committed Yet 0.3%
17 David Baumgold 0.2%
12 Brian J Brennan 0.1%
6 Leandro López 0.1%
6 Jan Krueger 0.1%
6 Gunnlaugur Thor Briem 0.1%
3 Hogan Long 0.0%
3 Curtis McEnroe 0.0%
3 Alex McHale 0.0%
3 Aggelos Orfanakos 0.0%
2 Phally 0.0%
2 NANRI 0.0%
2 Moritz Grauel 0.0%
1 Jean Jordaan 0.0%
1 Daniel Schildt 0.0%
```
## git-effort [file ....]
Displays "effort" statistics, currently just the number of commits per file, showing highlighting where the most activity is. The "active days" column is the total number of days which contributed modifications to this file.
```
node (master): git effort --above 15 {src,lib}/*
```
![git effort](http://f.cl.ly/items/0b0w0S2K1d100e2T1a0D/Screen%20Shot%202012-02-08%20at%206.43.34%20PM.png)
If you wish to ignore files with commits `<=` a value you may use `--above`:
```
$ git effort --above 5
```
By default `git ls-files` is used, however you may pass one or more files to `git-effort(1)`, for example:
```
$ git effort bin/* lib/*
```
## git-repl
GIT read-eval-print-loop:
```bash
$ git repl
git> ls-files
History.md
Makefile
Readme.md
bin/git-changelog
bin/git-count
bin/git-delete-branch
bin/git-delete-tag
bin/git-ignore
bin/git-release
git> quit
```
## git-commits-since [date]
List commits since `date` (defaults to "last week"):
```bash
$ git commits-since
... changes since last week
TJ Holowaychuk - Fixed readme
TJ Holowaychuk - Added git-repl
TJ Holowaychuk - Added git-delete-tag
TJ Holowaychuk - Added git-delete-branch
$ git commits-since yesterday
... changes since yesterday
TJ Holowaychuk - Fixed readme
```
## git-count
Output commit count:
```bash
$ git count
total 1844
```
Output detailed commit count:
```bash
$ git count --all
visionmedia (1285)
Tj Holowaychuk (430)
Aaron Heckmann (48)
csausdev (34)
ciaranj (26)
Guillermo Rauch (6)
Brian McKinney (2)
Nick Poulden (2)
Benny Wong (2)
Justin Lilly (1)
isaacs (1)
Adam Sanderson (1)
Viktor Kelemen (1)
Gregory Ritter (1)
Greg Ritter (1)
ewoudj (1)
James Herdman (1)
Matt Colyer (1)
total 1844
```
## git-fork
Fork the given github &lt;repo&gt;. Like clone but forks first.
```Shell
$ git fork https://github.com/LearnBoost/expect.js
```
or just:
```Shell
$ git fork LearnBoost/expect.js
```
Does the following:
- forks the repo (prompts for github username and pass)
- clones the repo into the current directory
- adds the original repo as a remote so can track upstream changes
- all remotes refs use git over ssh
```Shell
$ cd expect.js && git remote -v
origin git@github.com:<user>/expect.js (fetch)
origin git@github.com:<user>/expect.js (push)
original git@github.com:LearnBoost/expect.js (fetch)
original git@github.com:LearnBoost/expect.js (push)
```
## git-release
Release commit with the given &lt;tag&gt;:
```bash
$ git release 0.1.0
```
Does the following:
- Executes _.git/hooks/pre-release.sh_ (if present)
- Commits changes (to changelog etc) with message "Release &lt;tag&gt;"
- Tags with the given &lt;tag&gt;
- Push the branch / tags
- Executes _.git/hooks/post-release.sh_ (if present)
## git-alias
Define, search and show aliases.
Define a new alias:
```bash
$ git alias last "cat-file commit HEAD"
```
Search for aliases that match a pattern (one argument):
```bash
$ git alias ^la
last = cat-file commit HEAD
```
Show all aliases (no arguments):
```bash
$ git alias
s = status
amend = commit --amend
rank = shortlog -sn --no-merges
whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short
whois = !sh -c 'git log -i -1 --pretty="format:%an <%ae>
```
## git-ignore [pattern ...]
Too lazy to open up `.gitignore`? Me too!
```bash
$ git ignore build "*.o" "*.log"
... added 'build'
... added '*.o'
... added '*.log'
```
Without any patterns, `git-ignore` displays currently ignored patterns:
```bash
$ git ignore
build
*.o
*.log
```
## git-info
Show information about the repo:
```bash
$ git info
## Remote URLs:
origin git@github.com:sampleAuthor/git-extras.git (fetch)
origin git@github.com:sampleAuthor/git-extras.git (push)
## Remote Branches:
origin/HEAD -> origin/master
origin/myBranch
## Local Branches:
myBranch
* master
## Most Recent Commit:
commit e3952df2c172c6f3eb533d8d0b1a6c77250769a7
Author: Sample Author <sampleAuthor@gmail.com>
Added git-info command.
Type 'git log' for more commits, or 'git show <commit id>' for full commit details.
## Configuration (.git/config):
color.diff=auto
color.status=auto
color.branch=auto
user.name=Sample Author
user.email=sampleAuthor@gmail.com
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.url=git@github.com:mub/git-extras.git
branch.master.remote=origin
branch.master.merge=refs/heads/master
```
If you wish to omit the config section, you may use `--no-config`:
```bash
$ git info --no-config
```
## git-create-branch &lt;name&gt;
Create local and remote branch `name`:
```bash
$ git create-branch development
```
## git-delete-branch &lt;name&gt;
Delete local and remote branch `name`:
```bash
$ git delete-branch integration
```
## git-delete-submodule &lt;name&gt;
Delete submodule `name`:
```bash
$ git delete-submodule lib/foo
```
## git-delete-tag &lt;name&gt;
Delete local and remote tag `name`:
```bash
$ git delete-tag 0.0.1
```
## git-delete-merged-branches
Deletes branches that are listed in `git branch --merged`.
```bash
$ git delete-merged-branches
Deleted feature/themes (was c029ab3).
Deleted feature/live_preview (was a81b002).
Deleted feature/dashboard (was 923befa).
...
```
## git-fresh-branch &lt;name&gt;
Create empty local branch `name`:
```bash
$ git fresh-branch docs
```
## git-graft &lt;src-branch&gt; [dest-branch]
Merge commits from `src-branch` into `dest-branch`. (`dest-branch` defaults to `master`.)
```bash
$ git graft new_feature dev
$ git graft new_feature
```
## git-squash &lt;src-branch|commit ref&gt; [msg]
Merge commits from `src-branch` into the current branch as a _single_ commit.
Also works if a commit reference from the current branch is provided.
When `[msg]` is given `git-commit(1)` will be invoked with that message. This is
useful when small individual commits within a topic branch are irrelevant and
you want to consider the topic as a single change.
```bash
$ git squash fixed-cursor-styling
$ git squash fixed-cursor-styling "Fixed cursor styling"
$ git squash 95b7c52
$ git squash HEAD~3
$ git squash HEAD~3 "Work on a feature"
```
## git-changelog
Populate a file whose name matches `change|history -i_` with commits
since the previous tag. (If there are no tags, populates commits since the project began.)
Opens the changelog in `$EDITOR` when set.
```bash
$ git changelog --tag 1.5.2 && cat History.md
1.5.2 / 2010-08-05
==================
* Docs for git-ignore. Closes #3
* Merge branch 'ignore'
* Added git-ignore
* Fixed <tag> in docs
* Install docs
* Merge branch 'release'
* Added git-release
* Passing args to git shortlog
* Added --all support to git-count
* Initial commit
```
List commits:
```bash
$ git changelog --list
* Docs for git-ignore. Closes #3
* Merge branch 'ignore'
* Added git-ignore
* Fixed <tag> in docs
* Install docs
* Merge branch 'release'
* Added git-release
* Passing args to git shortlog
* Added --all support to git-count
* Initial commit
```
## git-undo
Remove the latest commit:
```bash
git undo
```
Remove the latest 3 commits:
```bash
git undo 3
```
## git-setup [dir]
Set up a git repository (if one doesn't exist), add all files, and make an initial commit. `dir` defaults to the current working directory.
## git-touch [filename]
Call `touch` on the given file, and add it to the current index. One-step creation of new files.
## git-obliterate [filename]
Completely remove a file from the repository, including past commits and tags.
```bash
git obliterate secrets.json
```
## git-local-commits
List all commits on the local branch that have not yet been sent to origin. Any additional arguments will be passed directly to git log.
## git-archive-file
Creates an zip archive of the current git repository. The name of the archive will depend on the current HEAD of your git respository.
## git-missing [branch1] branch2
Print out which commits are on one branch or the other but not both.
```bash
$ git missing master
< d14b8f0 only on current checked out branch
> 97ef387 only on master
```
## git-rebase-patch patch-file
Given a patch that doesn't apply to the current HEAD, find the latest commit
it applies to and do a rebase. For example:
```bash
$ git rebase-patch test.patch
Trying to find a commit the patch applies to...
Patch applied to dbcf408dd26 as 7dc8b23ae1a
First, rewinding head to replay your work on top of it...
Applying: test.patch
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging README.txt
```
## git-lock filename
Lock a local file `filename`:
```bash
$ git lock config/database.yml
```
## git-unlock filename
Unlock a local file `filename`
## git-reset-file filename [commit]
Reset one file to `HEAD` or certain commit
Reset one file to HEAD
```bash
$ git reset-file .htaccess
```
or reset one file to certain commit
```bash
$ git reset-file .htaccess dc82b19
```
## git-pr number
Checks out a pull request from GitHub
```bash
$ git pr 226
From https://github.com/visionmedia/git-extras
* [new ref] refs/pulls/226/head -> pr/226
Switched to branch 'pr/226'
```
For example, `git config git-extras.default-branch master`.

45
bin/git-abort Executable file
View file

@ -0,0 +1,45 @@
#!/usr/bin/env bash
set -euo pipefail
# git rev-parse emits an error if not in a git repo so only need to bail out
gitdir="$(git rev-parse --git-dir)" || exit
discover_op() {
local op
for op in cherry_pick merge rebase revert ; do
if [ -f "${gitdir}/${op^^}_HEAD" ]; then
echo "${op/_/-}"
fi
done
}
validate_op() {
local op="$1"
if [ -z "$op" ]; then
echo "No active operation found" >&2
exit 1
fi
if [[ "$(echo "$op" | wc -l)" -gt 1 ]]; then
echo "Multiple active operations found:" >&2
for o in $op; do
echo " - $o: HEAD: $(cat "${gitdir}/${o}_HEAD")" >&2
done
exit 1
fi
}
discover_action() {
local action=${1/git-/}
if [ "$action" != "abort" ] && [ "$action" != "continue" ]; then
echo "Invalid action: $1" >&2
exit 1
fi
echo "$action"
}
action=$(discover_action "$(basename "$0")")
op=$(discover_op)
validate_op "$op"
git "$op" "--$action"

View file

@ -1,7 +1,45 @@
#!/bin/sh
#!/usr/bin/env bash
options=""
usage() {
cat <<HERE
usage: git alias [options] # list all aliases
or: git alias [options] <search-pattern> # show aliases matching pattern
or: git alias [options] <alias-name> <command> # alias a command
options:
--global Show or create alias in the system config
--local Show or create alias in the repository config
HERE
}
if [[ "$1" == "--local" || "$1" == "--global" ]]; then
options=$1
shift
fi
case $# in
0) git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /' | sort ;;
1) git alias | grep -e "$1" ;;
*) git config --global "alias.$1" "$2" ;;
0)
if [[ -z "$options" ]]; then
git config --get-regexp 'alias.*' | sed 's/^alias\.//' | sed 's/[ ]/ = /' | sort
else
git config "$options" --get-regexp 'alias.*' | sed 's/^alias\.//' | sed 's/[ ]/ = /' | sort
fi
;;
1)
if [[ -z "$options" ]]; then
git config --get-regexp 'alias.*' | sed 's/^alias\.//' | sed 's/[ ]/ = /' | sort | grep -e "$1"
else
git config "$options" --get-regexp 'alias.*' | sed 's/^alias\.//' | sed 's/[ ]/ = /' | sort | grep -e "$1"
fi
;;
2)
if [[ -z "$options" ]]; then
git config alias."$1" "$2"
else
git config "$options" alias."$1" "$2"
fi
;;
*) >&2 echo "error: too many arguments." && usage && exit 1 ;;
esac

View file

@ -1,34 +1,37 @@
#!/usr/bin/env bash
# extract current branch name
BRANCH=$(git name-rev HEAD 2> /dev/null | awk "{ print \$2 }")
BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
# get name of the most top folder of current directory, used for the
# output filename
ARCHIVE_NAME=$(basename $(pwd))
ARCHIVE_NAME=$(basename "$(git rev-parse --show-toplevel)")
if [[ $BRANCH = tags* ]]; then
BRANCH=$(git describe)
echo Building for tag \"$BRANCH\"
FILENAME=$ARCHIVE_NAME.$BRANCH.zip
BRANCH=$(git describe)
echo Building for tag "\"$BRANCH\""
FILENAME=$ARCHIVE_NAME.$BRANCH.zip
else
echo Building archive on branch \"$BRANCH\"
# get a version string, so archives will not be overwritten when creating
# many of them
VERSION=$(git describe --always --long)
# if not on master append branch name into the filename
if [ "$BRANCH" = "master" ]; then
FILENAME=$ARCHIVE_NAME.$VERSION.zip
else
FILENAME=$ARCHIVE_NAME.$VERSION.$BRANCH.zip
fi
echo Building archive on branch "\"$BRANCH\""
# get a version string, so archives will not be overwritten when creating
# many of them
VERSION=$(git describe --always --long)
# if not on master append branch name into the filename
if [ "$BRANCH" = "$(git_extra_default_branch)" ]; then
FILENAME=$ARCHIVE_NAME.$VERSION.zip
else
FILENAME=$ARCHIVE_NAME.$VERSION.$BRANCH.zip
fi
fi
# rename invalid chars for the file path
FILENAME=${FILENAME//\//-}
FILENAME=${FILENAME//\\/-}
# combine path and filename
OUTPUT=$(pwd)/$FILENAME
OUTPUT=$PWD/$FILENAME
# building archive
git archive --format zip --output $OUTPUT $BRANCH
git archive --format zip --output "$OUTPUT" "$BRANCH"
# also display size of the resulting file
echo Saved to \"$FILENAME\" \(`du -h $OUTPUT | cut -f1`\)
echo Saved to \""$FILENAME"\" \("$(du -h "$OUTPUT" | cut -f1)"\)

54
bin/git-authors Executable file
View file

@ -0,0 +1,54 @@
#!/usr/bin/env bash
LIST=false
NO_EMAIL=false
FILE=""
while [[ $# -gt 0 ]]; do
case $1 in
-l|--list )
LIST=true
shift
;;
--no-email )
NO_EMAIL=true
shift
;;
* )
break
esac
done
if ! $LIST; then
FILE=$1
if [ -z "$FILE" ]; then
FILE=$(find . -mindepth 1 -maxdepth 1 \( -iname '*authors*' -o -iname '*contributors*' \) | head -n1)
if [ -z "$FILE" ]; then
FILE='AUTHORS'
fi
fi
fi
#
# list authors sorted by number of commits (descending).
#
authors() {
if $NO_EMAIL; then
# email will be used to uniq authors.
git shortlog HEAD -sne | awk '{$1=""; sub(" ", ""); print}' | awk -F'<' '!x[$1]++' | awk -F'<' '!x[$2]++' \
| awk -F'<' '{gsub(/ +$/, "", $1); print $1}'
else
git shortlog HEAD -sne | awk '{$1=""; sub(" ", ""); print}' | awk -F'<' '!x[$1]++' | awk -F'<' '!x[$2]++'
fi
}
#
# authors.
#
if $LIST; then
authors
else
authors >> "$FILE"
fi

View file

@ -1,11 +0,0 @@
#!/bin/sh
if test $# -eq 0; then
git reset --soft HEAD~1
else
if `echo $1 | grep -q [^[:digit:]]`; then
echo "$1 is not a number" 1>&2
else
git reset --soft HEAD~$1
fi
fi

92
bin/git-browse Executable file
View file

@ -0,0 +1,92 @@
#!/usr/bin/env bash
remote=${1:-""}
branch=""
filename=${2:-""}
line1=${3:-""}
line2=${4:-""}
# get remote name
if [[ $remote == "" ]]; then
branch="$(git rev-parse --abbrev-ref HEAD 2>/dev/null)"
remote=$(git config branch."${branch}".remote || echo "origin")
fi
if [[ $remote == "" ]]; then
echo "Remote not found"
exit 1
fi
remote_url=$(git remote get-url "$remote") || exit $?
if [[ $remote_url = git@* ]]; then
url=$(echo "$remote_url" | sed -E -e 's/:/\//' -e 's/\.git$//' -e 's/.*@(.*)/http:\/\/\1/')
elif [[ $remote_url = http* ]]; then
url=${remote_url%.git}
fi
# construct urls
commit_hash=$(git rev-parse HEAD 2>/dev/null)
commit_or_branch=${commit_hash:-${branch}}
if [[ $remote_url =~ gitlab ]]; then
# construct gitlab urls
# https://gitlab.com/<user_or_group>/<repo>/-/blob/<commit_or_branch>/<filename>#L<line1>-<line2>
if [[ -n ${filename} ]]; then
url="${url}/-/blob/${commit_or_branch}/${filename}"
if [[ -n "${line1}" ]]; then
url="${url}#L${line1}"
if [[ -n "${line2}" ]]; then
url="${url}-${line2}"
fi
fi
fi
elif [[ $remote_url =~ github ]]; then
# construct github urls
# https://github.com/<user_or_org>/<repo>/blob/<commit_or_branch>/<filename>#L<line1>-L<line2>
if [[ -n "${filename}" ]]; then
url="${url}/blob/${commit_or_branch}/${filename}"
if [[ -n "${line1}" ]]; then
url="${url}#L${line1}"
if [[ -n "${line2}" ]]; then
url="${url}-L${line2}"
fi
fi
fi
elif [[ $remote_url =~ bitbucket ]]; then
# construct bitbucket urls
# https://bitbucket.org/<user_or_org>/<repo>/src/<commit_or_branch>/<filename>#lines-<line1>:<line2>
if [[ -n ${filename} ]]; then
url=${url}/src/${commit_or_branch}/${filename}
if [[ -n "${line1}" ]]; then
url="${url}#lines-${line1}"
if [[ -n "${line2}" ]]; then
url="${url}:${line2}"
fi
fi
fi
fi
# open url
case "$OSTYPE" in
darwin*)
# MacOS
open "$url"
;;
msys)
# Git-Bash on Windows
start "$url"
;;
linux*)
# Handle WSL on Windows
if uname -a | grep -i -q Microsoft && command -v powershell.exe; then
powershell.exe -NoProfile start "$url"
else
xdg-open "$url"
fi
;;
*)
# fall back to xdg-open for BSDs, etc.
xdg-open "$url"
;;
esac

60
bin/git-browse-ci Executable file
View file

@ -0,0 +1,60 @@
#!/usr/bin/env bash
set -e -o pipefail
if [[ $1 == "" ]]
then
branch=$(git rev-parse --abbrev-ref HEAD &> /dev/null)
remote=$(git config branch."${branch}".remote || echo "origin")
else
remote=$1
fi
if [[ -z $remote ]]
then
echo "Remote not found"
exit 1
fi
remote_url=$(git remote get-url "${remote}") || exit $?
if [[ $remote_url = git@* ]]
then
url=$(echo "${remote_url}" | sed -E -e 's/:/\//' -e 's/\.git$//' -e 's/.*@(.*)/http:\/\/\1/')
elif [[ $remote_url = http* ]]
then
url=${remote_url%.git}
fi
if [[ $url =~ github ]]
then
ci_url=${url}/actions
elif [[ $url =~ gitlab ]]
then
ci_url=${url}/-/pipelines
elif [[ $url =~ bitbucket ]]
then
ci_url=${url}/addon/pipelines/home
fi
case "$OSTYPE" in
darwin*)
# MacOS
open "${ci_url}"
;;
msys)
# Git-Bash on Windows
start "${ci_url}"
;;
linux*)
# Handle WSL on Windows
if uname -a | grep -i -q Microsoft && command -v powershell.exe
then
powershell.exe -NoProfile start "${ci_url}"
else
xdg-open "${ci_url}"
fi
;;
*)
# fall back to xdg-open for BSDs, etc.
xdg-open "${ci_url}"
;;
esac

81
bin/git-brv Executable file
View file

@ -0,0 +1,81 @@
#!/usr/bin/env bash
# A sorted prettier branch -vv
if ! (( BASH_VERSINFO[0] > 4 ||
BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] >= 2 )); then
printf >&2 'This script requires bash 4.2 or newer\n'
exit 1
fi
# allow the user to set a default reverse option in an environment variable
reverse=$(git config --get git-extras.brv.reverse || echo false)
while [[ $# -gt 0 ]]; do
case $1 in
-r | --reverse)
reverse=true
shift
;;
*)
break
;;
esac
done
if [[ -t 1 ]]; then
shopt -s checkwinsize
COLUMNS=$(tput cols)
color_branch_local=$(git config --get-color color.branch.local normal)
color_branch_current=$(git config --get-color color.branch.current green)
color_diff_commit=$(git config --get-color color.diff.commit yellow)
color_branch_upstream=$(git config --get-color color.branch.upstream blue)
reset=$(tput sgr0)
fi
declare -A upstream date hash message
eval "$(
git for-each-ref --format='upstream[%(refname:short)]=%(upstream:short)' \
--shell 'refs/heads/**'
)"
for b in "${!upstream[@]}"; do
blen=${#b} ulen=${#upstream[$b]}
(( bwidth = blen > bwidth ? blen : bwidth ))
(( uwidth = ulen > uwidth ? ulen : uwidth ))
IFS=/ read -r 'date[$b]' 'hash[$b]' 'message[$b]' < <(
git log --no-walk=unsorted --format=%ct/%h/%s "$b" --
)
hlen=${#hash[$b]}
(( hwidth = hlen > hwidth ? hlen : hwidth ))
done
mapfile -t ordered < <(
# the reverse option of git-brv causes the sort to be sorted normally rather than in reverse
reverse_opt=""
if [[ $reverse = false ]]; then
reverse_opt="-r"
fi
for b in "${!date[@]}"; do
printf '%d\t%s\n' "${date[$b]}" "$b"
done | sort -n $reverse_opt | cut -f2-
)
current=$(git symbolic-ref -q --short HEAD)
for b in "${ordered[@]}"; do
branch_color=$color_branch_local
if [[ $b = "$current" ]]; then
branch_color=$color_branch_current
fi
if [[ -t 1 ]]; then
msg=${message[$b]:0:COLUMNS-bwidth-uwidth-hwidth-14}
else
msg=${message[$b]}
fi
printf '%(%Y-%m-%d)T %s%*s%s %s%*s%s %s%*s%s %s\n' \
"${date[$b]}" \
"$branch_color" "-$bwidth" "$b" "$reset" \
"$color_branch_upstream" "-$uwidth" "${upstream[$b]}" "$reset" \
"$color_diff_commit" "-$hwidth" "${hash[$b]}" "$reset" \
"$msg"
done

View file

@ -1,15 +0,0 @@
#!/bin/sh
if test "$1" = "finish"; then
test -z $2 && echo "bug <name> required." 1>&2 && exit 1
branch=bug/$2
git merge --no-ff $branch && git delete-branch $branch
else
test -z $1 && echo "bug <name> required." 1>&2 && exit 1
if test -n "$2"; then
echo "too many arguments; if not finishing a bug, only <name> of new bug is expected" && exit 1
fi
branch=bug/$1
git checkout -b $branch &> /dev/null
test -n $? && git checkout $branch &> /dev/null
fi

231
bin/git-bulk Executable file
View file

@ -0,0 +1,231 @@
#!/usr/bin/env bash
inverse=$(tput rev)
reset=$(tput sgr0)
txtbld=$(tput bold)
bldred=${txtbld}$(tput setaf 1)
# default option settings
guardedmode=false
singlemode=false
allwsmode=false
quiet=false
no_follow_symlinks=false
no_follow_hidden=false
#
# print usage message
#
usage() {
echo 1>&2 "usage: git bulk [--no-follow-symlinks] [--no-follow-hidden] [-q|--quiet] [-g] ([-a]|[-w <ws-name>]) <git command>"
echo 1>&2 " git bulk --addworkspace <ws-name> <ws-root-directory> (--from <URL or file>)"
echo 1>&2 " git bulk --removeworkspace <ws-name>"
echo 1>&2 " git bulk --addcurrent <ws-name>"
echo 1>&2 " git bulk --purge"
echo 1>&2 " git bulk --listall"
}
cdfail() {
echo 1>&2 "failed to change directory: $1"
exit 1
}
# add another workspace to global git config
addworkspace() {
git config --global bulkworkspaces."$wsname" "$wsdir";
if [ -n "$source" ]; then
if [ ! -d "$wsdir" ]; then echo 1>&2 "Path of workspace doesn't exist, make it first."; exit 1; fi
regex='http(s)?://|ssh://|(git@)?.*:.*/.*'
if [[ "$source" =~ $regex ]]; then
pushd "$wsdir" > /dev/null || cdfail "$wsdir"
git clone "$source"
popd > /dev/null || cdfail "$OLDPWD"
else
source=$(realpath "$source" 2>/dev/null)
if [ -f "$source" ]; then
pushd "$wsdir" > /dev/null || cdfail "$wsdir"
while IFS= read -r line; do
if [ -n "$line" ]; then
# the git clone command to take the complete line in the repository.txt as separate argument. This facilitated the cloning of the repository with a custom folder name.
# shellcheck disable=SC2086
git clone $line;
fi
done < "$source"
popd > /dev/null || cdfail "$OLDPWD"
else
echo 1>&2 "format of URL or file unknown"
fi
fi
fi
}
# add current directory
addcurrent() { git config --global bulkworkspaces."$wsname" "$PWD"; }
# remove workspace from global git config
removeworkspace() { checkWSName && git config --global --unset bulkworkspaces."$wsname"; }
# remove workspace from global git config
purge() { git config --global --remove-section bulkworkspaces; }
# list all current workspace locations defined
listall() { git config --global --get-regexp bulkworkspaces; }
# guarded execution of a git command in one specific repository
guardedExecution () {
if [ "${quiet?}" != "true" ] || $guardedmode; then
echo 1>&2 "${bldred}->${reset} executing ${inverse}git $gitcommand${reset} in repository ${leadingpath%/*}/${bldred}${curdir##*/}${reset}"
fi
if $guardedmode; then
echo 1>&2 -n " Execute command here (y/n)? "
read -n 1 -r </dev/tty; echo 1>&2
if [[ $REPLY =~ ^[Yy]$ ]]; then
git "$@"
fi
else
git "$@"
fi
}
# check if the passed command is known as a core git command
checkGitCommand () {
if git help -a | grep -o -q "\b${corecommand}\b"; then
echo 1>&2 "Core command \"$corecommand\" accepted."
else
if git config --get-regexp alias | grep -o -q "\.${corecommand} "; then
echo 1>&2 "Alias ${corecommand} accepted."
else
usage && echo 1>&2 "error: unknown GIT command: $corecommand" && exit 1
fi
fi
}
# check if workspace name is registered
checkWSName () {
while read -r workspace; do
parseWsName "$workspace"
if [[ $rwsname == "$wsname" ]]; then return; fi
done <<< "$(listall)"
# when here the ws name was not found
usage && echo 1>&2 "error: unknown workspace name: $wsname" && exit 1
}
# parse out wsname from workspacespec
parseWsName () {
local wsspec="$1"
# Get the workspace value from its specification in the `.gitconfig`.
# May be an absolute path or a variable name of the form: `$VARNAME`
rwsdir=${wsspec#* }
if [[ ${rwsdir:0:1} == '$' ]]; then
# Dereference the `rwsdir` value which is a variable name.
rwsdir_varname=${rwsdir:1}
rwsdir=${!rwsdir_varname}
if [[ -z "${rwsdir}" ]]; then
echo 1>&2 "error: bad environment variable: $rwsdir_varname" && exit 1
fi
fi
rwsname=${wsspec#*.} && rwsname=${rwsname%% *}
}
# detects the wsname of the current directory
wsnameToCurrent () {
while read -r workspace; do
if [ -z "$workspace" ]; then continue; fi
parseWsName "$workspace"
if echo "$PWD" | grep -o -q "$rwsdir"; then wsname="$rwsname" && return; fi
done <<< "$(listall)"
# when here then not in workspace dir
echo 1>&2 "error: you are not in a workspace directory. your registered workspaces are:" && \
wslist="$(listall)" && echo 1>&2 "${wslist:-'<no workspaces defined yet>'}" && exit 1
}
# helper to check number of arguments.
allowedargcount () {
if [ "$paramcount" -ne "${1:-0}" ] && [ "$paramcount" -ne "${2:-0}" ]; then
echo 1>&2 "error: wrong number of arguments" && usage;
exit 1;
fi
}
# execute the bulk operation
executBulkOp () {
checkGitCommand
if ! $allwsmode && ! $singlemode; then wsnameToCurrent; fi # by default git bulk works within the 'current' workspace
listall | while read -r workspacespec; do
parseWsName "$workspacespec"
if [[ -n $wsname ]] && [[ $rwsname != "$wsname" ]]; then continue; fi
cd "$rwsdir" || exit 1
local actual=$PWD
[ "${quiet?}" != "true" ] && echo 1>&2 "Executing bulk operation in workspace ${inverse}$actual${reset}"
# build `find` flags depending on command-line options
local find_flags=()
if [[ "$no_follow_symlinks" == true ]]; then
find_flags+=(-P)
else
find_flags+=(-L)
fi
# find all git repositories under the workspace on which we want to operate
readarray allGitFolders < <(find "${find_flags[@]}" . -name ".git" 2>/dev/null)
for line in "${allGitFolders[@]}"; do
local gitrepodir=${line::${#line}-5} # cut the .git part of find results to have the root git directory of that repository
cd "$gitrepodir" || exit 1 # into git repo location
local curdir=$PWD
local leadingpath=${curdir#"${actual}"}
# do not execute if we do not want to consider a ".git" directory under a hidden directory
if [ $no_follow_hidden = false ] || ! [[ "$leadingpath" =~ "/." ]]; then
guardedExecution "$@"
fi
cd "$rwsdir" || exit 1 # back to origin location of last find command
done
done
}
paramcount="${#}"
# if no arguments show usage
if [[ $paramcount -le 0 ]]; then usage; fi
# parse command parameters
while [ "${#}" -ge 1 ] ; do
case "$1" in
--quiet|-q) quiet='true' ;;
--listall|--purge)
butilcommand="${1:2}" && break ;;
--removeworkspace|--addcurrent|--addworkspace)
butilcommand="${1:2}" && wsname="$2" && wsdir="$3" && if [ "$4" = "--from" ]; then source="$5"; fi && break ;;
--no-follow-symlinks)
no_follow_symlinks=true ;;
--no-follow-hidden)
no_follow_hidden=true ;;
-a)
allwsmode=true ;;
-g)
guardedmode=true ;;
-w)
singlemode=true && shift && wsname="$1" && checkWSName ;;
--*)
usage && echo 1>&2 "error: unknown argument $1" && exit 1 ;;
-*)
usage && echo 1>&2 "error: unknown argument $1" && exit 1 ;;
*) # git core commands
butilcommand="executBulkOp" && corecommand="$1" && gitcommand="$*" && break ;;
esac && shift
done
# check option compatibility
if $allwsmode && $singlemode; then echo 1>&2 "error: options -w and -a are incompatible" && exit 1; fi
# if single mode check the supplied workspace name
if $singlemode; then echo 1>&2 "Selected single workspace mode in workspace: $wsname" && checkWSName; fi
# check right number of arguments
case $butilcommand in
listall|purge) allowedargcount 1;;
addcurrent|removeworkspace) allowedargcount 2;;
addworkspace) allowedargcount 3 5;;
esac
# pass the origin arguments to the 'executBulkOp'
$butilcommand "$@" # run user command

View file

@ -1,56 +1,597 @@
#!/bin/sh
#!/usr/bin/env bash
FILE=""
LIST=false
TAG="n.n.n"
GIT_LOG_OPTS=""
DEF_TAG_RECENT="n.n.n"
GIT_LOG_OPTS="$(git config changelog.opts)"
GIT_LOG_FORMAT="$(git config changelog.format)"
[[ -z "$GIT_LOG_FORMAT" ]] && GIT_LOG_FORMAT=' * %s'
GIT_MERGELOG_FORMAT="$(git config changelog.mergeformat)"
[[ -z "$GIT_MERGELOG_FORMAT" ]] && GIT_MERGELOG_FORMAT=' * %s%n%w(64,4,4)%b'
GIT_EDITOR="$(git var GIT_EDITOR)"
PROGNAME="git-changelog"
while [ "$1" != "" ]; do
case $1 in
-l | --list )
LIST=true
;;
-t | --tag )
TAG=$2
shift
;;
--no-merges )
GIT_LOG_OPTS='--no-merges'
;;
* )
FILE=$1
;;
esac
shift
done
git_editor() {
if test -z "${GIT_EDITOR:+set}"
then
GIT_EDITOR="$(git var GIT_EDITOR)" || return $?
fi
DATE=`date +'%Y-%m-%d'`
HEAD="\n$TAG / $DATE\n"
for i in $(seq 5 ${#HEAD}); do HEAD="$HEAD="; done
HEAD="$HEAD\n\n"
eval "$GIT_EDITOR" '"$@"'
}
if $LIST; then
lasttag=$(git rev-list --tags --max-count=1 2>/dev/null)
version=$(git describe --tags --abbrev=0 $lasttag 2>/dev/null)
if test -z "$version"; then
git log $GIT_LOG_OPTS --pretty="format: * %s"
_usage() {
cat << EOF
usage: $PROGNAME options [file]
usage: $PROGNAME -h|help|?
Generate a Changelog from git(1) tags (annotated or lightweight) and commit
messages. Existing Changelog files with filenames that begin with 'Change' or
'History' will be identified automatically and their content will be appended
to the new output generated (unless the -p|--prune-old option is used). If no
tags exist, then all commits are output; if tags exist, then only the most-
recent commits are output up to the last identified tag.
OPTIONS:
-a, --all Retrieve all commits (ignores --start-tag/commit, --final-tag)
-l, --list Display commits as a list, with no titles
-t, --tag Tag label to use for most-recent (untagged) commits
-f, --final-tag Newest tag to retrieve commits from in a range
-s, --start-tag Oldest tag to retrieve commits from in a range
--start-commit Like --start-tag but use commit instead of tag
-n, --no-merges Suppress commits from merged branches
-m, --merges-only Only uses merge commits (uses both subject and body of commit)
-p, --prune-old Replace existing Changelog entirely with new content
-x, --stdout Write output to stdout instead of to a Changelog file
-h, --help, ? Show this message
EOF
}
_error() {
[ $# -eq 0 ] && _usage && exit 0
echo
echo "ERROR: " "$@"
echo
}
# _setValueForKeyFakeAssocArray()
# /*!
# @abstract Set value for key from a fake associative array
# @discussion
# Iterates over target_ary (an indexed array), searching for target_key, if the
# key is found its value is set to new_value otherwise the target_key and
# new_value are appended to the array.
#
# The indexed array values must conform to this format:
# "key:value"
# Where key and value are separated by a single colon character.
#
# Specify empty values as an empty, quoted string.
#
# So-called "fake" associative arrays are useful for environments where the
# installed version of bash(1) precedes 4.0.
# @param target_key Key to retrieve
# @param new_value New or updated value
# @param target_ary Indexed array to scan
# @return Returns new array with updated key (status 0) or an empty array
# (status 1) on failure.
# */
_setValueForKeyFakeAssocArray() {
# parameter list supports empty arguments!
local target_key="$1"; shift
local new_value="$1"; shift
local target_ary=()
local defaultIFS="$IFS"
local IFS="$defaultIFS"
local found=false
IFS=$' ' target_ary=( $1 ) IFS="$defaultIFS"
[[ -z "${target_key}" || "${#target_ary[@]}" -eq 0 ]] && echo "${value}" && return 1
local _target_ary_length="${#target_ary[@]}"
local i
for (( i=0; i<"${_target_ary_length}"; i++ )); do
local __val="${target_ary[$i]}"
if [[ "${__val%%:*}" == "${target_key}" ]]; then
target_ary[$i]="${__val%%:*}:${new_value}"
found=true
break
fi
unset __val
done
unset i _target_ary_length
# key not found, append
[[ "$found" == false ]] && target_ary+=( "${target_key}:${new_value}" )
printf "%s" "${target_ary[*]}"
}
# _valueForKeyFakeAssocArray()
# /*!
# @abstract Fetch value for key from a fake associative array
# @discussion
# Iterates over target_ary (an indexed array), searching for target_key, if the
# key is found its value is returned.
#
# The indexed array values must conform to this format:
# "key:value"
# Where key and value are separated by a single colon character.
#
# So-called "fake" associative arrays are useful for environments where the
# installed version of bash(1) precedes 4.0.
# @param target_key Key to retrieve
# @param target_ary Indexed array to scan
# @return Returns string containing value (status 0) or an empty string
# (status 1) on failure.
# */
_valueForKeyFakeAssocArray() {
local target_key="$1"
local target_ary=()
local defaultIFS="$IFS"
local IFS="$defaultIFS"
local value=""
IFS=$' ' target_ary=( $2 ) IFS="$defaultIFS"
[[ -z "${target_key}" || "${#target_ary[@]}" -eq 0 ]] && echo "${value}" && return 1
local t
for t in "${target_ary[@]}"; do
if [[ "${t%%:*}" == "${target_key}" ]]; then
value="${t#*:}"
break
fi
done
unset t
echo -e "${value}"; return 0
}
_fetchCommitRange() {
local list_all="${1:-false}"
local start_tag="$2"
local final_tag="$3"
# This shellcheck disable is applied to the whole if-body
# shellcheck disable=SC2086
if [[ "$list_all" == true ]]; then
git log $GIT_LOG_OPTS --pretty=format:"${CUR_GIT_LOG_FORMAT}"
elif [[ -n "$final_tag" && "$start_tag" == "null" ]]; then
git log $GIT_LOG_OPTS --pretty=format:"${CUR_GIT_LOG_FORMAT}" "${final_tag}"
elif [[ -n "$final_tag" ]]; then
git log $GIT_LOG_OPTS --pretty=format:"${CUR_GIT_LOG_FORMAT}" "${start_tag}"'..'"${final_tag}"
elif [[ -n "$start_tag" ]]; then
git log $GIT_LOG_OPTS --pretty=format:"${CUR_GIT_LOG_FORMAT}" "${start_tag}"'..'
fi | sed 's/^ \* \*/ */g'
}
_formatCommitPlain() {
local start_tag="$1"
local final_tag="$2"
printf "%s\n" "$(_fetchCommitRange "false" "$start_tag" "$final_tag")"
}
_formatCommitPretty() {
local title_tag="$1"
local title_date="$2"
local start_tag="$3"
local final_tag="$4"
local title="$title_tag / $title_date"
local title_underline=""
local i
for i in $(seq ${#title}); do
title_underline+="="
done
unset i
printf '\n%s\n%s\n' "$title" "$title_underline"
printf "\n%s\n" "$(_fetchCommitRange "false" "$start_tag" "$final_tag")"
}
commitList() {
# parameter list supports empty arguments!
local list_all="${1:-false}"; shift
local title_tag="$1"; shift
local start_tag="$1"; shift
local final_tag="$1"; shift
local list_style="${1:-false}"; shift # enable/disable list format
local start_commit="$1"; shift
local changelog="$FILE"
local title_date="$(date +'%Y-%m-%d')"
local tags_list=()
local tags_list_keys=()
local defaultIFS="$IFS"
local IFS="$defaultIFS"
if [[ -n "$start_commit" && "$final_tag" == "null" \
&& "$start_tag" == "null" ]]; then
# if there is not tag after $start_commit,
# output directly without fetch all tags
if [[ "$list_style" == true ]]; then
_formatCommitPlain "${start_commit}~"
else
_formatCommitPretty "$title_tag" "$title_date" "$start_commit~"
fi
return
fi
#
# Tags look like this:
#
# >git log --tags --simplify-by-decoration --date="short" --pretty="format:%h$%x09%ad$%x09%d"
#
# ecf1f2b$ 2015-03-15$ (HEAD, tag: v1.0.1, origin/master, origin/HEAD, master, hotfix/1.0.2)
# a473e9c$ 2015-03-04$ (tag: v1.0.0)
# f2cb562$ 2015-02-19$ (tag: v0.9.2)
# 6197c2b$ 2015-02-19$ (tag: v0.9.1)
# 1e5f5e6$ 2015-02-16$ (tag: v0.9.0)
# 3de8ab5$ 2015-02-11$ (origin/feature/restore-auto)
# a15afd1$ 2015-02-02$ (origin/feature/versionable)
# 38a44e0$ 2015-02-02$ (origin/feature/save-auto)
# 3244b80$ 2015-01-16$ (origin/feature/silent-history, upstream)
# 85e45f8$ 2014-08-25$
#
# The most-recent tag will be preceded by "HEAD, " if there have been zero
# commits since the tag. Also notice that with gitflow, we see features.
#
# fetch our tags
local _ref _date _tag _tab='%x09'
local _tag_regex='tag: *'
while IFS=$'\t' read -r _ref _date _tag; do
[[ -z "${_tag}" ]] && continue
# strip out tags form ()
# git v2.2.0+ supports '%D', like '%d' without the " (", ")" wrapping. One day we should use it instead.
_tag="${_tag# }"; _tag="${_tag//[()]/}"
# trap tag if it points to last commit (HEAD)
_tag="${_tag#HEAD*, }"
# strip out branches
[[ ! "${_tag}" =~ ${_tag_regex} ]] && continue
# strip out any additional tags pointing to same commit, remove tag label
_tag="${_tag%%,*}"; _tag="${_tag#tag: }"
# add tag to assoc array; copy tag to tag_list_keys for ordered iteration
tags_list+=( "${_tag}:${_ref}=>${_date}" )
tags_list_keys+=( "${_tag}" )
done <<< "$(git log --tags --simplify-by-decoration --date="short" --pretty="format:%h${_tab}%ad${_tab}%d")"
IFS="$defaultIFS"
unset _tag_regex
unset _ref _date _tag _tab
local _tags_list_keys_length="${#tags_list_keys[@]}"
if [[ "${_tags_list_keys_length}" -eq 0 ]]
then
unset _tags_list_keys_length
if [[ "$list_style" == true ]]; then
printf "%s" "$(_fetchCommitRange "true")"
else
local title="$title_tag / $title_date"
local title_underline=""
local i
for i in $(seq ${#title}); do
title_underline+="="
done
unset i
printf '\n%s\n%s\n' "$title" "$title_underline"
printf "\n%s\n" "$(_fetchCommitRange "true")"
fi
return
fi
local _final_tag_found=false
local _start_tag_found=false
local i
for (( i=0; i<"${_tags_list_keys_length}"; i++ )); do
local __curr_tag="${tags_list_keys[$i]}"
local __prev_tag="${tags_list_keys[$i+1]:-null}"
local __curr_date
__curr_date="$(_valueForKeyFakeAssocArray "${__curr_tag}" "${tags_list[*]}")"
__curr_date="${__curr_date##*=>}"
# output latest commits, up until the most-recent tag, these are all
# new commits made since the last tagged commit.
if [[ $i -eq 0 && ( -z "$final_tag" || "$final_tag" == "null" ) ]]; then
if [[ "$list_style" == true ]]; then
_formatCommitPlain "${__curr_tag}" >> "$tmpfile"
else
_formatCommitPretty "$title_tag" "$title_date" "${__curr_tag}"
fi
fi
# both final_tag and start_tag are "null", user just wanted recent commits
[[ "$final_tag" == "null" && "$start_tag" == "null" ]] && break;
# find the specified final tag, continue until found
if [[ -n "$final_tag" && "$final_tag" != "null" ]]; then
[[ "$final_tag" == "${__curr_tag}" ]] && _final_tag_found=true
[[ "$final_tag" != "${__curr_tag}" && "${_final_tag_found}" == false ]] && continue
fi
# find the specified start tag, break when found
if [[ -n "$start_tag" ]]; then
[[ "$start_tag" == "${__curr_tag}" ]] && _start_tag_found=true
if [[ "${_start_tag_found}" == true ]]; then
if [[ -n "$start_commit" ]]; then
# output commits after start_commit to its closest tag
if [[ "$list_style" == true ]]; then
_formatCommitPlain "$start_commit~" "${__curr_tag}"
else
_formatCommitPretty "${__curr_tag}" "${__curr_date}" \
"$start_commit~" "${__curr_tag}"
fi
break
fi
[[ "$start_tag" != "${__curr_tag}" ]] && break
fi
fi
# output commits made between prev_tag and curr_tag, these are all of the
# commits related to the tag of interest.
if [[ "$list_style" == true ]]; then
_formatCommitPlain "${__prev_tag}" "${__curr_tag}"
else
_formatCommitPretty "${__curr_tag}" "${__curr_date}" "${__prev_tag}" "${__curr_tag}"
fi
unset __curr_date
unset __prev_tag
unset __curr_tag
done
unset i
unset _start_tag_found
unset _final_tag_found
unset _tags_list_keys_length
return
}
commitListPlain() {
local list_all="${1:-false}"
local start_tag="$2"
local final_tag="$3"
local start_commit="$4"
commitList "$list_all" "" "$start_tag" "$final_tag" "true" "$start_commit"
}
commitListPretty() {
local list_all="${1:-false}"
local title_tag="$2"
local start_tag="$3"
local final_tag="$4"
local start_commit="$5"
local title_date="$(date +'%Y-%m-%d')"
commitList "$list_all" "$title_tag" "$start_tag" "$final_tag" "false" \
"$start_commit"
}
_exit() {
local pid_list=()
local defaultIFS="$IFS"
local IFS="$defaultIFS"
stty sane; echo; echo "caught signal, shutting down"
IFS=$'\n'
# The format of `ps` is different between Windows and other platforms,
# so we need to calculate the total column number(COL_NUM) of header first.
# Why don't we just use the last column?
# Because the body of CMD column may contain space and be treated as multiple fields.
pid_list=( $(ps -f |
awk -v ppid=$$ 'NR == 1 {
COL_NUM = NF
}
$3 == ppid {
# filter out temp processes created in this subshell
if ($COL_NUM != "ps" && $COL_NUM != "awk" && $COL_NUM !~ "bash$")
print $2
}')
)
IFS="$defaultIFS"
local _pid
for _pid in "${pid_list[@]}"; do
echo "killing: ${_pid}"
kill -TERM "${_pid}"
done
wait; stty sane; exit 1
}
trap '_exit' SIGINT SIGQUIT SIGTERM
main() {
local start_tag="null" # empty string and "null" mean two different things!
local final_tag="null"
local option=(
"list_all:false"
"list_style:false"
"title_tag:$DEF_TAG_RECENT"
"start_tag:"
"start_commit:"
"final_tag:"
"output_file:"
"use_stdout:false"
"prune_old:false"
)
#
# We work chronologically backwards from NOW towards start_tag where NOW also
# includes the most-recent (un-tagged) commits. If no start_tag has been
# specified, we work back to the very first commit; if a final_tag has been
# specified, we begin at the final_tag and work backwards towards start_tag.
#
# An existing ChangeLog/History file will be appended to the output unless the
# prune old (-p | --prune-old) option has been enabled.
while [ "$1" != "" ]; do
case $1 in
-a | --all )
option=( $(_setValueForKeyFakeAssocArray "list_all" true "${option[*]}") )
;;
-l | --list )
option=( $(_setValueForKeyFakeAssocArray "list_style" true "${option[*]}") )
;;
-t | --tag )
option=( $(_setValueForKeyFakeAssocArray "title_tag" "$2" "${option[*]}") )
shift
;;
-f | --final-tag )
option=( $(_setValueForKeyFakeAssocArray "final_tag" "$2" "${option[*]}") )
shift
;;
-s | --start-tag )
option=( $(_setValueForKeyFakeAssocArray "start_tag" "$2" "${option[*]}") )
shift
;;
--start-commit )
option=( $(_setValueForKeyFakeAssocArray "start_commit" "$2" "${option[*]}") )
shift
;;
-n | --no-merges )
GIT_LOG_OPTS='--no-merges'
CUR_GIT_LOG_FORMAT="$GIT_LOG_FORMAT"
;;
-m | --merges-only )
GIT_LOG_OPTS='--merges'
CUR_GIT_LOG_FORMAT="$GIT_MERGELOG_FORMAT"
;;
-p | --prune-old )
option=( $(_setValueForKeyFakeAssocArray "prune_old" true "${option[*]}") )
;;
-x | --stdout )
option=( $(_setValueForKeyFakeAssocArray "use_stdout" true "${option[*]}") )
;;
-h | ? | help | --help )
_usage
exit 1
;;
* )
[[ "${1:0:1}" == '-' ]] && _error "Invalid option: $1" && _usage && exit 1
option=( $(_setValueForKeyFakeAssocArray "output_file" "$1" "${option[*]}") )
;;
esac
shift
done
# The default log format unless already set
[[ -z "$CUR_GIT_LOG_FORMAT" ]] && CUR_GIT_LOG_FORMAT="$GIT_LOG_FORMAT"
local _tag="$(_valueForKeyFakeAssocArray "start_tag" "${option[*]}")"
local start_commit="$(_valueForKeyFakeAssocArray "start_commit" "${option[*]}")"
if [[ -n "$start_commit" ]]; then
if [[ -n "${_tag}" ]]; then
_error "--start-tag could not use with --start-commit!"
return 1
fi
start_tag="$(git describe --tags --contains "$start_commit" 2>/dev/null || echo 'null')"
if [[ -z "$start_tag" ]]; then
_error "Could find the associative tag for the start-commit!"
return 1
fi
# remove suffix from the $start_tag when no tag matched exactly
start_tag="${start_tag%%~*}"
# also remove "^0" added sometimes when tag matched exactly
start_tag="${start_tag%%^0}"
elif [[ -n "${_tag}" ]]; then
start_tag="$(git describe --tags --abbrev=0 "${_tag}" 2>/dev/null)"
if [[ -z "$start_tag" ]]; then
_error "Specified start-tag does not exist!"
return 1
fi
fi
if [[ -n "${_tag}" ]]; then
if [[ -n "$start_commit" ]]; then
_error "--start-tag could not use with --start-commit!"
return 1
fi
fi
unset _tag
local _tag="$(_valueForKeyFakeAssocArray "final_tag" "${option[*]}")"
if [[ -n "${_tag}" ]]; then
final_tag="$(git describe --tags --abbrev=0 "${_tag}" 2>/dev/null)"
if [[ -z "$final_tag" ]]; then
_error "Specified final-tag does not exist!"
return 1
fi
fi
unset _tag
#
# generate changelog
#
local tmpfile changelog title_tag
tmpfile="$(git_extra_mktemp)"
changelog="$(_valueForKeyFakeAssocArray "output_file" "${option[*]}")"
title_tag="$(_valueForKeyFakeAssocArray "title_tag" "${option[*]}")"
if [[ "$(_valueForKeyFakeAssocArray "list_style" "${option[*]}")" == true ]]; then
if [[ "$(_valueForKeyFakeAssocArray "list_all" "${option[*]}")" == true ]]; then
commitListPlain "true" >> "$tmpfile"
else
commitListPlain "false" "$start_tag" "$final_tag" \
"$start_commit" >> "$tmpfile"
fi
else
git log $GIT_LOG_OPTS --pretty="format: * %s" $version..
if [[ "$(_valueForKeyFakeAssocArray "list_all" "${option[*]}")" == true ]]; then
commitListPretty "true" "$title_tag" >> "$tmpfile"
else
commitListPretty "false" "$title_tag" "$start_tag" "$final_tag" \
"$start_commit" >> "$tmpfile"
fi
fi
exit
fi
CHANGELOG=$FILE
if test "$CHANGELOG" = ""; then
CHANGELOG=`ls | egrep 'change|history' -i|head -n1`
if test "$CHANGELOG" = ""; then
CHANGELOG='History.md';
if [[ -z "$changelog" ]]; then
changelog="$(find . -mindepth 1 -maxdepth 1 \( -iname '*change*' -o -iname '*history*' \) | head -n1)"
if [[ -z "$changelog" ]]; then
changelog="History.md";
fi
fi
fi
tmp="/tmp/changelog"
printf "$HEAD" > $tmp
git-changelog $GIT_LOG_OPTS --list >> $tmp
printf '\n' >> $tmp
if [ -f $CHANGELOG ]; then cat $CHANGELOG >> $tmp; fi
mv $tmp $CHANGELOG
test -n "$EDITOR" && $EDITOR $CHANGELOG
# append existing changelog?
if [[ -f "$changelog" \
&& "$(_valueForKeyFakeAssocArray "prune_old" "${option[*]}")" == false ]]; then
cat "$changelog" >> "$tmpfile"
fi
# output file to stdout or move into place
if [[ "$(_valueForKeyFakeAssocArray "use_stdout" "${option[*]}")" == true ]]; then
cat "$tmpfile"
rm -f "$tmpfile"
else
cp -f "$tmpfile" "$changelog"
rm -f "$tmpfile"
if [[ -n "$GIT_EDITOR" ]]; then
git_editor "$changelog" || _exit
else
less "$changelog" || _exit
fi
fi
return
}
main "$@"
exit 0

43
bin/git-clear Executable file
View file

@ -0,0 +1,43 @@
#!/usr/bin/env bash
PROGNAME="git-clear"
FORCE=0
_usage() {
cat << EOF
usage: $PROGNAME options
usage: $PROGNAME -h|help|?
clear git repository
OPTIONS:
-f, --force Force clear without questioning user
-h, --help, ? Show this message
EOF
}
# Read arguments
while [ "$1" != "" ]; do
case $1 in
-f|--force)
FORCE=1
;;
-h|--help|?)
_usage
exit 1
;;
esac
shift
done
# Only wait for answer if not forced by user
if [[ $FORCE == 0 ]]; then
echo -n "Sure? - THIS COMMAND MAY DELETE FILES THAT CANNOT BE RECOVERED, including those in .gitignore [y/N]: "
read -r clean
else
clean=y
fi
if [ "$clean" = "y" ]; then
git clean -d -f -x && git reset --hard
fi

7
bin/git-clear-soft Executable file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env bash
echo -n "Sure? - This command may delete files that cannot be recovered. Files and directories in .gitignore will be preserved [y/N]: "
read -r answer
if [ "$answer" = "y" ]
then git clean -d -f && git reset --hard
fi

17
bin/git-coauthor Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -e -o pipefail
coauthor=$1
email=$2
test -z "$coauthor" && echo "co-author required." 1>&2 && exit 1
test -z "$email" && echo "co-author email required." 1>&2 && exit 1
old_message="$(git log --format=%B -n1)"
if [[ "$old_message" == *"Co-authored-by:"* ]]; then
git commit --amend -m "$old_message
Co-authored-by: $coauthor <$email>"
else
git commit --amend -m "$old_message" -m "Co-authored-by: $coauthor <$email>"
fi

View file

@ -1,6 +1,36 @@
#!/bin/sh
#!/usr/bin/env bash
SINCE="last week"
test $# -ne 0 && SINCE=$@
echo "... commits since $SINCE" >&2
git log --pretty='%an - %s' --after="@{$SINCE}"
REF=""
SINCE=""
while [[ $# -gt 0 ]]; do
case "$1" in
-r|--ref)
if [[ -z "$2" ]]; then
echo "error: option $1 requires an argument" >&2
exit 1
fi
REF="$2"
shift
shift
;;
*)
# non-flag args accumulation, e.g. "last " + "week" -> "last week"
SINCE="${SINCE:+$SINCE }$1"
shift
;;
esac
done
if [[ -n "$REF" && -n "$SINCE" ]]; then
echo "error: '--ref <ref>' and '<date>' are mutually exclusive" >&2
exit 1
fi
SINCE="${SINCE:-last week}"
if [[ -n "$REF" ]]; then
git log --pretty='%h %an - %s' "$REF..HEAD"
else
git log --pretty='%h %an - %s' --after="@{$SINCE}"
fi

1
bin/git-continue Symbolic link
View file

@ -0,0 +1 @@
git-abort

View file

@ -1,9 +1,7 @@
#!/bin/sh
#!/usr/bin/env bash
user="$*"
test -z "$user" && echo "user name required." 1>&2 && exit 1
count=`git log --oneline --pretty="format: %an" | grep "$user" | wc -l`
test $count -eq 0 && echo "$user did not contribute." && exit 1
git shortlog | grep "$user (" -A $count
git shortlog --format=format:"%h %s" --author="$user"

View file

@ -1,8 +1,8 @@
#!/bin/sh
#!/usr/bin/env bash
if test "$1" = "--all"; then
git shortlog -n -s $@ | awk '{print substr($0,index($0,$2)) " (" $1 ")"}'
git shortlog -n -s | awk '{print substr($0,index($0,$2)) " (" $1 ")"}'
echo
fi
echo total `git rev-list --count HEAD`
echo total "$(git rev-list --count HEAD)"

78
bin/git-cp Executable file
View file

@ -0,0 +1,78 @@
#!/usr/bin/env bash
set -euo pipefail
PROGRAM=$0
CURRENT_FILENAME=""
DESTINATION_FILENAME=""
function usage()
{
echo 1>&2 "USAGE: ${PROGRAM} CURRENT_FILENAME DESTINATION_FILENAME"
}
while [[ $# -gt 0 ]]
do
key="$1"
if [[ "$CURRENT_FILENAME" == "" ]]; then
CURRENT_FILENAME=$key
elif [[ "$DESTINATION_FILENAME" == "" ]]; then
DESTINATION_FILENAME=$key
else
usage
exit 30 # Error during arguments parsing
fi
shift # past argument or value
done
if [[ "$DESTINATION_FILENAME" == "" ]]; then
usage
exit 20 # Missing arguments CURRENT_FILENAME
elif [[ "$CURRENT_FILENAME" == "" ]]; then
usage
exit 10 # Missing arguments CURRENT_FILENAME
else
if [ -e "$DESTINATION_FILENAME" ]; then
echo 1>&2 "$DESTINATION_FILENAME already exists."
echo 1>&2 "Make sure to remove the destination first."
exit 40
fi
if [[ "$DESTINATION_FILENAME" == */ ]]; then
echo 1>&2 "$DESTINATION_FILENAME is not a file path."
exit 80
fi
if [[ "$DESTINATION_FILENAME" == */* ]]; then
DESTINATION_DIR="${DESTINATION_FILENAME%/*}"
if ! mkdir -p "$DESTINATION_DIR"; then
echo 1>&2 "Failed to create destination directory: $DESTINATION_DIR"
exit 160
fi
fi
echo "Copying $CURRENT_FILENAME into $DESTINATION_FILENAME"
# Pre-check that the source and destination will work
git mv --dry-run "${CURRENT_FILENAME}" "${DESTINATION_FILENAME}"
# Make a new branch and switch to it
BRANCH_NAME="git-cp-$(date +%s)"
git checkout -b "$BRANCH_NAME"
# Move the original file to the new destination, in this branch
git mv "${CURRENT_FILENAME}" "${DESTINATION_FILENAME}"
git commit -nm "--Duplicate $CURRENT_FILENAME history into $DESTINATION_FILENAME"
# Restore the original file to keep it in the history
git checkout HEAD~ "${CURRENT_FILENAME}"
git commit -nm "--Restore $CURRENT_FILENAME"
# Switch to the original branch and merge this back in.
git checkout -
git merge --no-ff "$BRANCH_NAME" -m "Copy $CURRENT_FILENAME into $DESTINATION_FILENAME"
# We're now done with the branch, so delete it.
# We shouldn't need -D here, as we've already merged it back in.
git branch -d "$BRANCH_NAME"
fi

View file

@ -1,8 +1,76 @@
#!/bin/sh
#!/usr/bin/env bash
branch=$1
test -z $branch && echo "branch required." 1>&2 && exit 1
test $# -eq 0 && echo "branch argument required." 1>&2 && exit 1
git push origin HEAD:refs/heads/$branch
git fetch origin
git checkout --track -b $branch origin/$branch
# preference takes lowest priority; look for remote from prefs first
REMOTE_PREF=$(git config git-extras.create-branch.remote)
if [ -n "$REMOTE_PREF" ]; then
REMOTE=$REMOTE_PREF
fi
while test $# != 0
do
case $1 in
-r|--remote)
if [[ -n $2 ]]
then
REMOTE=$2
shift
else
REMOTE=origin
fi
;;
--from)
if [[ -n $2 ]]; then
START_POINT=$2
shift
fi
;;
*)
BRANCH=$1
esac
shift
done
# handle ambiguous `-r` option argument by shift
if [[ -z $BRANCH ]] && [[ -n $REMOTE ]]
then
BRANCH=$REMOTE
REMOTE=origin
fi
test -z "$BRANCH" && echo "branch argument required." 1>&2 && exit 1
if [[ -n $REMOTE ]]
then
stderr=$(git_extra_mktemp)
git ls-remote --exit-code "$REMOTE" 1>/dev/null 2>"$stderr"
REMOTE_EXIT=$?
REMOTE_ERROR=$(<"$stderr")
rm -f "$stderr"
if [ $REMOTE_EXIT -eq 0 ]
then
if [[ -n $START_POINT ]]; then
git fetch "$REMOTE"
git checkout --track -b "$BRANCH" "$START_POINT"
git push "$REMOTE" "HEAD:refs/heads/$BRANCH"
else
git push "$REMOTE" "HEAD:refs/heads/$BRANCH"
git fetch "$REMOTE"
git checkout --track -b "$BRANCH" "$REMOTE/$BRANCH"
fi
exit $?
else
echo
echo " Error connecting to remote '$REMOTE': $REMOTE_ERROR"
echo
exit $REMOTE_EXIT
fi
fi
if [[ -n $START_POINT ]]
then
git checkout -b "$BRANCH" "$START_POINT"
else
git checkout -b "$BRANCH"
fi

View file

@ -1,20 +1,17 @@
#!/bin/sh
#!/usr/bin/env bash
set -e
# Assert there is at least one branch provided
test -z $1 && echo "branch required." 1>&2 && exit 1
test -z "$1" && echo "branch required." 1>&2 && exit 1
# Concatenate all branch references
local_branches=""
origin_branches=""
origin_refs=""
for branch in "$@"
do
local_branches=$local_branches" $branch"
origin_branches=$origin_branches" origin/$branch"
origin_refs=$origin_refs" :refs/heads/$branch"
done
remote=$(git config "branch.$branch.remote" || echo "origin")
ref=$(git config "branch.$branch.merge" || echo "refs/heads/$branch")
# Delete all branches
git branch -D $local_branches
git branch -d -r $origin_branches
git push origin $origin_refs
git branch -D "$branch" || true
# Avoid deleting local upstream
[ "$remote" = "." ] && continue
git branch -d -r "$remote/$branch" || continue
git push "$remote" ":$ref"
done

60
bin/git-delete-gone-branches Executable file
View file

@ -0,0 +1,60 @@
#!/usr/bin/env bash
set -euo pipefail
dry_run=false
force=false
prune=false
while [[ $# -gt 0 ]]; do
case "$1" in
-n|--dry-run)
dry_run=true
shift
;;
-f|--force)
force=true
shift
;;
-p|--prune)
prune=true
shift
;;
*)
echo "Unknown option: $1"
echo "Usage: git delete-gone-branches [-n|--dry-run] [-f|--force] [-p|--prune]"
exit 1
;;
esac
done
if [ "$prune" = true ]; then
git fetch --prune
fi
gone_branches=$(git for-each-ref --format \
'%(if:equals=gone)%(upstream:track,nobracket)%(then)%(refname:short)%(end)' refs/heads/ | sed '/^$/d')
if [ -z "$gone_branches" ]; then
echo "No branches with a gone remote found."
exit 0
fi
if [ "$dry_run" = true ]; then
echo "Would delete the following branches:"
echo "$gone_branches"
exit 0
fi
echo "The following branches will be deleted:"
echo "$gone_branches"
if [ "$force" = false ]; then
read -r -p "Delete these branches? [y/N] " confirm
if [[ ! "$confirm" =~ ^[yY]$ ]]; then
echo "Aborted."
exit 0
fi
fi
echo "$gone_branches" | xargs git branch -D

View file

@ -1,3 +1,7 @@
#!/bin/sh
#!/usr/bin/env bash
git branch --merged | grep -v "\*" | grep -v master | xargs -n 1 git branch -d
branches=$(git branch --no-color --merged | grep -vE "^(\*|\+)" | grep -v "$(git_extra_default_branch)" | grep -v svn)
if [ -n "$branches" ]
then
echo "$branches" | xargs git branch -d
fi

View file

@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -euo pipefail
proceed=false
if [[ $# -gt 0 && ("$1" == "--proceed" || "$1" == "-p") ]]; then
proceed=true
shift
fi
if [[ $# -eq 0 ]]; then
targetBranch=$(git rev-parse --abbrev-ref HEAD)
else
targetBranch=$1
git checkout "$targetBranch"
fi
git for-each-ref refs/heads/ "--format=%(refname:short)" | while read -r branch; do
mergeBase=$(git merge-base "$targetBranch" "$branch")
if [[ $(git cherry "$targetBranch" "$(git commit-tree "$(git rev-parse "$branch^{tree}")" -p "$mergeBase" -m _)") == "-"* ]]; then
if [[ $proceed == true ]]; then
git branch -D "$branch" || true
else
git branch -D "$branch"
fi
fi
done

View file

@ -1,13 +1,50 @@
#!/bin/sh
#!/usr/bin/env bash
submodule=$1
abort() {
error="$1" && shift
echo "ERROR: $*" 1>&2
test -z "$FORCE" && exit "$error"
}
test -z $submodule && echo "submodule required" 1>&2 && exit 1
test ! -f .gitmodules && echo ".gitmodules file not found" 1>&2 && exit 2
# Don't abort on failures. This allows to cleanup after a previous failure.
[ "$1" = '--force' ] && FORCE=1 && shift
NAME=$(echo $submodule | sed 's/\/$//g')
test -z $(git config --file=.gitmodules submodule.$NAME.url) && echo "submodule not found" 1>&2 && exit 3
test -z "$1" && abort 1 'Submodule required'
cd "$(git root)" || abort 5 'Cannot change to repository root'
test ! -f '.gitmodules' && abort 2 '.gitmodules file not found'
git config --remove-section submodule.$NAME
git config --file=.gitmodules --remove-section submodule.$NAME
git rm --cached $NAME
NAME="${1%/}"
test -z "$(git config --file='.gitmodules' "submodule.$NAME.url")" \
&& abort 3 'Submodule not found'
# 1. Handle the .git directory
# 1.a. Delete the relevant section from .git/config
git submodule deinit -f "$NAME" || abort 4 "Failed to deinitialize $NAME"
# 1.b. Delete empty submodule directory
git rm -f "$NAME"
# 2. Handle .gitmodules file
# 2.a. Delete the relevant line from .gitmodules
git config --file='.gitmodules' --remove-section "submodule.$NAME" 2>/dev/null || :
# 2.b and stage changes
git add '.gitmodules'
# 2.c. Delete empty .gitmodules
[ "$(wc -l '.gitmodules' | cut -d' ' -f1)" = '0' ] && git rm -f '.gitmodules'
# 3. Need to confirm and commit the changes for yourself
git_status_text="$(git submodule status 2>&1)"
git_status_exit=$?
if [ "$git_status_exit" -eq 0 ] \
&& printf '%s' "DUMMY$git_status_text" | grep -v "$NAME" > /dev/null; then
# grep fails when piping in an empty string, so we add a DUMMY prefix
echo "Successfully deleted $NAME."
else
abort 6 "Failed to delete $NAME with error:\n$git_status_text"
fi
printf '\n%s\n' '== git submodule status =='
printf '%s\n' "$git_status_text"
printf '%s\n' '=========================='
# shellcheck disable=SC2016
echo 'Confirm the output of `git submodule status` above (if any)' \
'and then commit the changes.'

View file

@ -1,7 +1,16 @@
#!/bin/sh
#!/usr/bin/env bash
# Assert there is at least one tag provided
test -z $1 && echo "tag required." 1>&2 && exit 1
test -z "$1" && echo "tag required." 1>&2 && exit 1
# Detect the default remote exists or not
default_remote=$(git config git-extras.default-remote)
if [[ -n "$default_remote" ]]; then
origin="$default_remote"
else
origin=origin
fi
# Concatenate all the tag references
local_tags=""
@ -13,5 +22,7 @@ do
done
# Delete all the tags
# shellcheck disable=SC2086
git tag -d $local_tags
git push origin $origin_refs
# shellcheck disable=SC2086
git push "$origin" $origin_refs

15
bin/git-delta Executable file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env bash
branch=$(git_extra_default_branch)
filter=ACM
if test $# -eq 1; then
branch=$1
else
if test $# -eq 2; then
branch=$1
filter=$2
fi
fi
git diff --name-only --diff-filter="$filter" "$branch"

View file

@ -1,15 +1,29 @@
#!/usr/bin/env bash
tmp=/tmp/.git-effort
above='0'
tmp=$(git_extra_mktemp)
above=0
# if the output won't be printed to tty, disable the color
test -t 1 && to_tty=true
color=
#
# get date for the given <commit>
# print usage message
#
usage() {
echo 1>&2 "usage: git effort [--above <value>] [<path>...] [-- [<log options>...]]"
}
date() {
git log --pretty='format: %ai' $1 | cut -d ' ' -f 2
#
# get dates for the given <commit>
#
dates() {
eval "git log $args_to_git_log --pretty='format: %ad' --date=short -- \"$1\""
}
# tput, being quiet about unknown capabilities
tputq() {
tput "$@" 2>/dev/null
return 0
}
#
@ -17,17 +31,18 @@ date() {
#
hide_cursor() {
printf '\033[?25l'
tputq civis
}
#
# show cursor
# show cursor, and remove temporary file
#
show_cursor() {
printf '\033[?25h'
printf '\033[m\n'
exit 1
show_cursor_and_cleanup() {
tputq cnorm
tputq sgr0
rm "$tmp" > /dev/null 2>&1
exit 0
}
#
@ -35,10 +50,7 @@ show_cursor() {
#
active_days() {
date $1 | uniq | awk '
{ sum += 1 }
END { print sum }
'
echo "$1" | sort -r | uniq | wc -l
}
#
@ -46,45 +58,65 @@ active_days() {
#
color_for() {
test $1 -gt 10 && color='33'
test $1 -gt 25 && color='33;1'
test $1 -gt 50 && color='93'
test $1 -gt 75 && color='93;1'
test $1 -gt 100 && color='31'
test $1 -gt 125 && color='31;1'
test $1 -gt 150 && color='91'
test $1 -gt 200 && color='91;1'
if [ "$to_tty" = true ]; then
if [ "$1" -gt 200 ]; then color="$(tputq setaf 1)$(tputq bold)"
elif [ "$1" -gt 150 ]; then color="$(tputq setaf 1)" # red
elif [ "$1" -gt 125 ]; then color="$(tputq setaf 2)$(tputq bold)"
elif [ "$1" -gt 100 ]; then color="$(tputq setaf 2)" # green
elif [ "$1" -gt 75 ]; then color="$(tputq setaf 5)$(tputq bold)"
elif [ "$1" -gt 50 ]; then color="$(tputq setaf 5)" # purplish
elif [ "$1" -gt 25 ]; then color="$(tputq setaf 3)$(tputq bold)"
elif [ "$1" -gt 10 ]; then color="$(tputq setaf 3)" # yellow
else color="$(tputq sgr0)" # default color
fi
else
color=""
fi
}
#
# compute the effort of the given <file ...>
# compute the effort of the given <path ...>
#
effort() {
for file in "$@"; do
commits=`git log --oneline "$file" | wc -l`
path=$1
local commit_dates
local color reset_color commits len dot f_dot i msg active
reset_color=""
test "$to_tty" = true && reset_color="$(tputq sgr0)"
if ! commit_dates=$(dates "$path"); then
exit 255
fi
# Ensure it's not just an empty line
if [ -z "$(head -c 1 <<<"$commit_dates")" ]
then
exit 0
fi
commits=$(wc -l <<<"$commit_dates")
color='90'
# ignore <= --above
test $commits -le $above && continue
test "$commits" -le "$above" && exit 0
# commits
color_for $commits
len=${#file}
color_for $(( commits - above ))
len=${#path}
dot="."
f_dot="$file"
i=0 ; while test $i -lt $((45-$len)) ; do
f_dot="$path"
i=0 ; while test $i -lt $(( columns - len )) ; do
f_dot=$f_dot$dot
i=$(($i+1))
i=$((i+1))
done
printf " \033[${color}m%s %-10d" $f_dot $commits
msg=$(printf " ${color}%s %-10d" "$f_dot" "$commits")
# active days
active=`active_days "$file"`
color_for $active
printf "\033[${color}m %d\033[0m\n" $active
done
active=$(active_days "$commit_dates")
color_for $(( active - above ))
msg="$msg $(printf "${color} %d${reset_color}\n" "$active")"
echo "$msg"
}
#
@ -93,7 +125,7 @@ effort() {
heading() {
echo
printf " %-45s %-10s %s\n" 'file' 'commits' 'active days'
printf " %-${columns}s %-10s %s\n" 'path' 'commits' 'active days'
echo
}
@ -103,40 +135,100 @@ heading() {
sort_effort() {
clear
echo
echo " "
heading
cat $tmp | sort -rn -k 2
< "$tmp" sort -rn -k 2
}
# --above <n-commits>
#
# get processor count, default 8
#
procs() {
if ! (nproc --all || getconf NPROCESSORS_ONLN || getconf _NPROCESSORS_ONLN || grep -c processor /proc/cpuinfo) 2>/dev/null; then
echo 8
fi
}
declare -a paths=()
while [ "${#}" -ge 1 ] ; do
case "$1" in
--above)
shift
above=$1
;;
--)
shift
args_to_git_log=$(printf " %q" "${@:1}")
break
;;
--*)
usage
echo 1>&2 "error: unknown argument $1"
echo 1>&2 "error: if that argument was meant for git-log,"
echo 1>&2 "error: please put it after two dashes ( -- )."
exit 1
;;
*)
paths+=( "$1" )
;;
esac
if test "$1" = "--above"; then
shift; above=$1
shift
done
# Exit if above-value is not an int
if [ -z "${above##*[!0-9]*}" ] ; then
echo "error: argument to --above was not an integer" 1>&2
exit 1
fi
# [file ...]
# remove empty quotes that appear when there are no arguments
args_to_git_log="${args_to_git_log#\ \'\'}"
export args_to_git_log
declare -a files=()
if test $# -ge 1; then
files=("$@")
else
# [path ...]
if test "${#paths}" -eq 0; then
save_ifs=$IFS
IFS=`echo -en "\n\b"`
files=(`git ls-files`)
IFS=$safe_ifs
IFS=$(echo -en "\n\b")
paths=($(git ls-files))
IFS=$save_ifs
unset save_ifs
fi
# set column width to match longest filename
max=0
for path in "${paths[@]}"; do
cur=${#path}
if [[ $max -lt $cur ]]; then
max=$cur
fi
done
columns=$(( max + 5 ))
export columns
# hide cursor
hide_cursor
trap show_cursor INT
# loop files
trap show_cursor_and_cleanup INT
heading
effort "${files[@]}" | tee $tmp && sort_effort
# send paths to effort
nPaths=${#paths[@]}
nProcs=$(procs)
nJobs="\j"
for ((i=0; i<nPaths; ++i))
do
while (( ${nJobs@P} >= nProcs )); do
wait -n
done
effort "${paths[i]}" &
done|tee "$tmp"
# if more than one path, sort and print
test "$(wc -l "$tmp" | awk '{print $1}')" -gt 1 && sort_effort
echo
show_cursor
show_cursor_and_cleanup

View file

@ -1,29 +1,54 @@
#!/bin/sh
#!/usr/bin/env bash
VERSION="2.1.0"
VERSION="7.6.0-dev"
INSTALL_SCRIPT="https://raw.githubusercontent.com/tj/git-extras/main/install.sh"
update() {
local bin=$(which git-extras)
local bin="$(command -v git-extras)"
local prefix=${bin%/*/*}
local orig=$PWD
cd /tmp \
&& rm -fr ./git-extras \
&& git clone --depth 1 https://github.com/visionmedia/git-extras.git \
&& cd git-extras \
&& PREFIX="$prefix" make install \
curl -s $INSTALL_SCRIPT | PREFIX="$prefix" bash /dev/stdin \
&& cd "$orig" \
&& echo "... updated git-extras $VERSION -> $(git extras --version)"
}
updateForWindows() {
local bin="$(command -v git-extras)"
local prefix=${bin%/*/*}
local orig=$PWD
# we need to clean up /tmp manually on windows
cd /tmp \
&& rm -rf ./git-extras \
&& echo "Setting up 'git-extras'...." \
&& git clone https://github.com/tj/git-extras.git &> /dev/null \
&& cd git-extras \
&& git checkout \
$(git describe --tags $(git rev-list --tags --max-count=1)) \
&> /dev/null \
&& ./install.cmd "$prefix" \
&& cd "$orig" \
&& echo "... updated git-extras $VERSION -> $(git extras --version)"
rm -rf /tmp/git-extras &> /dev/null
}
case "$1" in
-v|--version)
echo $VERSION && exit 0
;;
update)
update
platform=$(uname -s)
if [ "${platform::9}" = "CYGWIN_NT" ] || \
[ "${platform::5}" = "MINGW" ] || \
[ "${platform::7}" = "MSYS_NT" ]
then
updateForWindows
else
update
fi
;;
*)
man git-extras
git extras --help
;;
esac

View file

@ -1,15 +1,105 @@
#!/bin/sh
#!/usr/bin/env bash
if test "$1" = "finish"; then
test -z $2 && echo "feature <name> required." 1>&2 && exit 1
branch=feature/$2
git merge --no-ff $branch && git delete-branch $branch
else
test -z $1 && echo "feature <name> required." 1>&2 && exit 1
if test -n "$2"; then
echo "too many arguments; if not finishing a feature, only <name> of new feature is expected" && exit 1
fi
branch=feature/$1
git checkout -b $branch &> /dev/null
test -n $? && git checkout $branch &> /dev/null
branch_prefix=$(git config --get git-extras.feature.prefix)
if [ -z "$branch_prefix" ]; then
branch_prefix="feature"
fi
branch_separator=$(git config --get git-extras.feature.separator)
if [ -z "$branch_separator" ]; then
branch_separator="/"
fi
merge_mode="--no-ff"
finish=false
declare -a argv
while test $# != 0
do
case $1 in
-a|--alias )
if [[ -n $2 ]] && [[ $2 != -- ]]
then
shift # shift -a|-alias
branch_prefix=$1
else
echo >&2 "option $1 requires a value"
exit 1
fi
;;
-r|--remote )
if [[ -n $2 ]] && [[ $2 != -- ]]
then
remote=$2
shift
else
remote="origin"
fi
;;
-s|--separator )
if [[ -n $2 ]] && [[ $2 != -- ]]
then
branch_separator=$2
shift
else
echo >&2 "option $1 requires a value"
exit 1
fi
;;
--squash )
merge_mode="--squash"
;;
--from )
start_point=$2
shift
;;
-- )
# terminate argument parsing
shift
argv+=("$@")
break
;;
finish )
finish=true
;;
* )
argv+=("$1")
;;
esac
shift
done
concatargs() {
str=$(IFS='-'; echo "$*")
branch="$branch_prefix$branch_separator$str"
}
test -z "${argv[0]}" && echo "$branch_prefix" "<name> required." 1>&2 && exit 1
concatargs "${argv[@]}"
if "${finish}"
then
git merge ${merge_mode} "$branch" && git delete-branch "$branch"
else
if [[ -n $remote ]] && [[ -z $start_point ]]
then
git create-branch -r "$remote" "$branch"
fi
if [[ -z $remote ]] && [[ -z $start_point ]]
then
git create-branch "$branch"
fi
if [[ -n $remote ]] && [[ -n $start_point ]]
then
git create-branch -r "$remote" --from "$start_point" "$branch"
fi
if [[ -z $remote ]] && [[ -n $start_point ]]
then
git create-branch --from "$start_point" "$branch"
fi
fi

109
bin/git-force-clone Executable file
View file

@ -0,0 +1,109 @@
#! /usr/bin/env bash
set -euo pipefail
_usage() {
echo "
Usage:
git-force-clone -b branch remote_url destination_path
Example:
git-force-clone -b master git@github.com:me/repo.git ./repo_dir
Provides the basic functionality of 'git clone', but if the destination git
repository already exists it will force-reset it to resemble a clone of the
remote.
Because it doesn't actually delete the directory, it is usually significantly
faster than the alternative of deleting the directory and cloning the
repository from scratch.
**CAUTION**: If the repository exists, this will destroy *all* local work:
changed files will be reset, local branches and other remotes will be removed.
OPTIONS:
-b, --branch The branch to pull from the remote
-h, --help Display this help message
"
}
_check() {
if [ -z "$1" ]; then
echo "Error: Missing ${2}"
_usage
exit 1
fi
}
main() {
while [[ -n "${1:-}" ]] && [[ "${1:0:1}" == "-" ]]; do
case $1 in
-b | --branch )
branch=${2:-}
shift
;;
-h | --help )
_usage
exit 0
;;
* )
echo "Error: Invalid option: $1" >>/dev/stderr
_usage
exit 1
;;
esac
shift
done
remote_url=${1:-}
destination_path=${2:-}
_check "${remote_url}" "remote_url"
_check "${destination_path}" "destination_path"
if [ -d "${destination_path}/.git" ]; then
(
cd "${destination_path}"
# Delete all remotes
for remote in $(git remote); do
git remote rm "${remote}"
done
# Add origin
git remote add origin "${remote_url}"
git fetch origin
# Set default branch
if [ -z "${branch:-}" ]; then
branch=$(LC_ALL=C git remote show origin | grep -oP '(?<=HEAD branch: )[^ ]+$')
git remote set-head origin "${branch}"
else
git remote set-head origin -a
fi
# Make sure current branch is clean
git clean -fd
git reset --hard HEAD
# Get on the desired branch
git checkout "${branch}"
git reset --hard "origin/${branch}"
# Delete all other branches
# shellcheck disable=SC2063
branches=$(git branch | grep -v '*' | xargs)
if [ -n "${branches}" ]; then
git branch -D "${branches}"
fi
)
elif [ -n "${branch:-}" ]; then
git clone -b "${branch}" "${remote_url}" "${destination_path}"
else
git clone "${remote_url}" "${destination_path}"
fi
}
main "$@"
exit 0

View file

@ -1,34 +1,67 @@
#!/usr/bin/env sh
#!/usr/bin/env bash
abort() {
echo $@
echo "$@"
exit 1
}
url="$1"
test -z "$url" && url=$(git remote get-url origin 2> /dev/null) && origin=true
# validate repo url
test -z "$1" && abort "github repo needs to be specified as an argument"
test -z "$url" && abort "github repo needs to be specified as an argument"
# validate user
echo "Enter your github username"
read user
[ "$user" = 'n' ] && abort "git username required"
read -r user
[ -n "$user" ] || abort "git username required"
# personal access token
# config name is github-personal-access-token '_' is not allowed in git config
github_personal_access_token=$(git config --default "$GITHUB_TOKEN" git-extras.github-personal-access-token)
test -z "$github_personal_access_token" && abort "GITHUB_TOKEN, or git config git-extras.github-personal-access-token required"
# extract owner + project from repo url
project=${1##*/}
owner=${1%/$project}
owner=${owner##*/}
project=${url##*/}
owner=${url%/"$project"}
project=${project%.git}
if [[ $owner == git@* ]]; then
owner=${owner##*:}
else
owner=${owner##*/}
fi
# validate
[ -z "$project" -o -z "$owner" ] && abort "github repo needs to be specified as an argument"
[[ -z "$project" || -z "$owner" ]] && abort "github repo needs to be specified as an argument"
# create pull request
curl -X POST -u "$user" "https://api.github.com/repos/$owner/$project/forks"
[ $? = 0 ] || abort "fork failed"
# create fork
if ! curl -qsf \
-X POST \
-u "$user:$github_personal_access_token" \
-H "X-GitHub-OTP: $MFA_CODE" \
"https://api.github.com/repos/$owner/$project/forks"
then
abort "fork failed"
fi
# clone forked repo into current dir
git clone "git@github.com:$user/$project" "$project"
echo "Add GitHub remote branch via SSH (you will be prompted to verify the server's credentials)? (y/n)"
read -r use_ssh
# Check if user has ssh configured with GitHub
if [ -n "$use_ssh" ] && ssh -T git@github.com 2>&1 | grep -qi 'success'; then
remote_prefix="git@github.com:"
else
remote_prefix="https://github.com/"
fi
# add reference to origin fork so can merge in upstream changes
cd "$project"
git remote add upstream "git@github.com:$owner/$project"
git fetch upstream
if [ "$origin" = true ]; then
git remote rename origin upstream
git remote add origin "${remote_prefix}${user}/${project}.git"
git fetch origin
else
# clone forked repo into current dir
git clone "${remote_prefix}${user}/${project}.git" "$project"
# add reference to origin fork so can merge in upstream changes
cd "$project" || exit
git remote add upstream "${remote_prefix}${owner}/${project}.git"
git fetch upstream
fi

View file

@ -1,9 +1,24 @@
#!/bin/sh
#!/usr/bin/env bash
branch=$1
test -z $branch && echo "branch required." 1>&2 && exit 1
test -z "$branch" && echo "branch required." 1>&2 && exit 1
git symbolic-ref HEAD refs/heads/$branch
rm .git/index
git clean -fdx
changes=$(git status --porcelain)
clean()
{
git symbolic-ref HEAD "refs/heads/$branch"
rm .git/index
git clean -fdx
}
if [ -n "$changes" ]; then
read -rp "All untracked changes will be lost. Continue [y/N]? " res
case $res in
[Yy]* ) ;;
* ) exit 0;;
esac
fi
clean

40
bin/git-get Executable file
View file

@ -0,0 +1,40 @@
#!/usr/bin/env bash
_usage() {
printf '%s\n' "usage: ${0##*/} <url>
usage: ${0##*/} --help
Clone a repository in a particular directory."
}
if (( $# == 0 )); then
_usage
exit 0
fi
for arg; do
if [ "$arg" = '-h' ] || [ "$arg" = '--help' ]; then
_usage
exit 0
fi
done
url=$1
if ! shift; then
printf 'ERROR: Failed to shift' >&2
exit 1
fi
clone_path=$(git config --get git-extras.get.clone-path)
if [ -z "$clone_path" ]; then
printf 'ERROR: %s\n' "Git configuration key 'git-extras.get.clone-path' must be set to a directory to clone under" >&2
exit 1
fi
dirname=${url%/}
dirname=${dirname%.git}
dirname=${dirname##*/}
mkdir -p "$clone_path"
git clone "$url" "$clone_path/$dirname" "$@"

View file

@ -1,12 +1,21 @@
#!/bin/sh
#!/usr/bin/env bash
echo 'setting up gh-pages'
git symbolic-ref HEAD refs/heads/gh-pages \
&& rm .git/index \
&& git clean -fdx \
&& echo 'My Page' > index.html \
&& git add . \
&& git commit -a -m 'Initial commit' \
&& git push -u origin gh-pages \
&& git fetch origin \
&& echo 'complete'
echo '-------------------'
echo 'Tell me your github account username: '
read -r username
echo 'Now, tell me your repository name: '
read -r repository
git stash \
&& git checkout -b 'gh-pages' \
&& echo 'My Page' > index.html \
&& git add . \
&& git commit -a -m 'Initial commit' \
&& git remote add origin https://github.com/"$username"/"$repository".git \
&& git push -u origin gh-pages \
&& echo 'Complete' \
&& echo '-------------------' \
&& echo 'You can find your last changes in the stash!'

View file

@ -1,10 +1,11 @@
#!/bin/sh
#!/usr/bin/env bash
src=$1
dst=$2
test -z $src && echo "source branch required." 1>&2 && exit 1
test -z "$src" && echo "source branch required." 1>&2 && exit 1
test -z "$dst" && echo "destination branch required." 1>&2 && exit 1
git checkout $dst \
&& git merge --no-ff $src \
&& git branch -d $src
git checkout "$dst" \
&& git merge --no-ff "$src" \
&& git branch -d "$src"

119
bin/git-guilt Executable file
View file

@ -0,0 +1,119 @@
#!/usr/bin/env bash
for param in "$@"
do
case $param in
-h)
echo 'Usage: git-guilt [<options>] <since> <until>'
echo 'Calculates the change in blame between two revisions'
echo 'Example: git guilt HEAD~3 HEAD'
echo
echo 'Options:'
echo
echo ' -h, --help output usage information'
echo ' -e, --email display author emails instead of names'
echo ' -w, --ignore-whitespace ignore whitespace only changes when attributing blame'
echo ' -d, --debug output debug information'
exit 0
;;
-e|--email )
EMAIL='-e'
shift
;;
-w|--ignore-whitespace )
NOT_WHITESPACE='-w'
shift
;;
-d|--debug )
DEBUG=$(git_extra_mktemp)
shift
;;
esac
done
cd "$(git-root)" || exit # cd for git blame
MERGED_LOG=$(git_extra_mktemp)
if [[ $EMAIL == '-e' ]]
then
PATTERN='s/^author-mail <\(.*\)>/\1/p'
else
PATTERN='s/^author //p'
fi
for file in $(git diff --name-only "$@")
do
test -n "$DEBUG" && echo "git blame $file"
# $1 - since $2 - until
# shellcheck disable=SC2086
git blame $NOT_WHITESPACE --line-porcelain "$1" -- "$file" 2> /dev/null |
LC_ALL=C sed -n "$PATTERN" | sort | uniq -c | LC_ALL=C sed 's/^\(.\)/- \1/' >> "$MERGED_LOG"
# if $2 not given, use current commit as "until"
# shellcheck disable=SC2086
git blame $NOT_WHITESPACE --line-porcelain "${2-@}" -- "$file" 2> /dev/null |
LC_ALL=C sed -n "$PATTERN" | sort | uniq -c | LC_ALL=C sed 's/^\(.\)/+ \1/' >> "$MERGED_LOG"
done
DEBUG="$DEBUG" awk '
NR==1 {
# the index of $2 does not change in each line
name_start_at = index($0, $3)
}
/^\+/ {
contributors[substr($0, name_start_at)] += $2
}
/^-/ {
contributors[substr($0, name_start_at)] -= $2
}
END {
for (people in contributors) {
if (ENVIRON["DEBUG"]) {
printf("%d %s\n", contributors[people], people) >> ENVIRON["DEBUG"]
}
if (contributors[people] != 0) {
printf("%d %s\n", contributors[people], people)
}
}
}' "$MERGED_LOG" | sort -nr | # only gawk supports built-in sort function
while read -r line
do
people=${line#* }
num=${line%% *}
if [[ $num -gt 0 ]]
then
printf "%-29s \033[00;32m" "$people"
if [[ $num -ge 50 ]]
then
len=${#num}
for (( i = 0; i < 48 - len; i++ ))
do
printf "+"
done
printf "(%s)" "$num"
else
for (( i = 0; i < num; i++ ))
do
printf "+"
done
fi
else
printf "%-29s \033[00;31m" "$people"
if [[ $num -le -50 ]]
then
len=${#num}
for (( i = 0; i < 48 - len; i++ ))
do
printf "-"
done
printf "(%s)" "$num"
else
for (( i = 0; i > num; i-- ))
do
printf "-"
done
fi
fi
printf "\033[00m\n"
done
test -n "$DEBUG" && sort -nr "$DEBUG"

View file

@ -1,50 +1,285 @@
#!/usr/bin/env bash
function show_contents {
test -f "$2" && echo "$1 gitignore: $2" && cat "$2"
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
# awk script that takes 2 input files. The first one is newline deilmeted
# string of patterns to look for, second one is the file to remove them from.
# outfile has to be passed with -v upon call and is the file result is
# written to.
read -r -d '' AWK_SCRIPT <<'EOF'
# process the first "file" (newline split argument list)
NR==FNR { a[b++]=$0; next; }
# process file
{
found=0;
for (i=0; i != b; i++) {
if (a[i] == $0) { found=1; }
}
if (found == 1) { print "... removing '"$0"'"; }
else { print $0 > outfile }
}
EOF
show_contents() {
local file="${2/#~/$HOME}"
if [ -f "$file" ]; then
echo "$1 gitignore: $2" && cat "$file"
else
echo "There is no $1 .gitignore yet"
fi
}
function show_global {
show_contents Global `git config --global core.excludesfile`
cd_to_git_root() {
local error_level="$1"
if ! git rev-parse --git-dir &>/dev/null; then
if [ "$error_level" = '--warn' ]; then
echo "Warning: Not currently in a Git repository" >&2
elif [ "$error_level" = '--error' ]; then
echo "Error: Not currently in a Git repository" >&2
exit 1
fi
fi
local result=
if result=$(git rev-parse --show-toplevel 2>/dev/null); then
cd "$result" || exit
fi
}
function add_global {
add_patterns `git config --global core.excludesfile` "$@"
global_ignore() {
if ! git config --global core.excludesFile 2>/dev/null; then
if [ -f "$HOME/.gitignore" ]; then
echo "$HOME/.gitignore"
else
echo "${XDG_CONFIG_HOME:-$HOME/.config}/git/ignore"
fi
fi
}
function show_local {
show_global() {
show_contents Global "$(global_ignore)"
}
add_global() {
local global_gitignore
global_gitignore="$(global_ignore)"
if [ -z "$global_gitignore" ]; then
echo "Can't find global .gitignore."
echo ""
echo "Use 'git config --global --add core.excludesfile ~/.gitignore-global' to set the path to your global gitignore file to '~/.gitignore-global'."
echo ""
else
add_patterns "$global_gitignore" "$@"
fi
}
show_local() {
cd_to_git_root --warn
show_contents Local .gitignore
}
function add_local {
add_local() {
cd_to_git_root --warn
add_patterns .gitignore "$@"
}
function add_patterns {
show_private() {
cd_to_git_root --error
show_contents Private "${GIT_DIR}/info/exclude"
}
add_private() {
cd_to_git_root --error
test -d "${GIT_DIR}/info" || mkdir -p "${GIT_DIR}/info"
add_patterns "${GIT_DIR}/info/exclude" "$@"
}
add_patterns() {
echo "Adding pattern(s) to: $1"
local file="${1/#~/$HOME}"
dir_name=$(dirname "$file")
if [ ! -d "$dir_name" ]; then
mkdir -p "$dir_name"
fi
if [ -s "$file" ]; then
# If the content of $file doesn't end with a newline, add one
test "$(tail -c 1 "$file")" != "" && echo "" >> "$file"
fi
for pattern in "${@:2}"; do
echo "... adding '$pattern'"
(test -f "$1" && test "$pattern" && grep -q "$pattern" "$1") || echo "$pattern" >> "$1"
(test -f "$file" && test "$pattern" && grep -q -F -x -- "$pattern" "$file") || echo "$pattern" >> "$file"
done
}
edit_file() {
local file="${2/#~/$HOME}"
if [ -f "$file" ]; then
echo "Editing $1 gitignore: ($2)" && eval "$(git var GIT_EDITOR) $(printf '%q' "$file")"
echo "Done."
else
echo "There is no $1 .gitignore yet." >&2
exit 1
fi
}
_usage() {
cat << EOF
Usage: git ignore [OPTION]... [PATTERN]...
Modify or display local global or private gitignore files.
OPTIONs set context (local, global, private) and action (display, add,
remove, edit). In case of collision, last flag overwrites preceding ones.
Defaults are: local context, action is display (see man git ignore for
more details).
Context examples:
local: .../repo/.gitignore
private: .../repo/.git/info/exclude
global: \$HOME/.gitignore
PATTERNs are the gitignore patterns as specified in git documentation.
Options:
-l, --local Set context to local gitignore
-g, --global Set context to global gitignore
-p, --private Set context to private gitignore
-e, --edit Set action to edit
-r, --remove Set action to remove
-h, --help Print this message
-- End of options delimiter
EOF
}
remove_patterns() {
declare -a args
local tmpfile
args=( "${@:3}" )
local file="${2/#~/$HOME}"
if [ -f "$file" ]; then
tmpfile="$(mktemp -q "${TMPDIR:-/tmp}"/git-extras-ignore.XXXXXX 2>/dev/null)"
echo "Removing patterns from $1 gitignore: $2"
awk -v outfile="$tmpfile" "${AWK_SCRIPT}"\
<(printf '%s\n' "${args[@]}") "$file"
cat "$tmpfile" > "$file"
rm "$tmpfile"
else
echo "There is no $1 .gitignore yet"
exit 1
fi
}
# can have only 1 action and 1 level, if conflicting flags are passed
# latter ones overwrite former
# sanity of args not tested (e.g. there should be no args if -e is supplied)
if test $# -eq 0; then
show_global
echo "---------------------------------"
show_local
echo "---------------------------------"
show_private
else
case "$1" in
-l|--local)
test $# -gt 1 && add_local "${@:2}" && echo
show_local
;;
-g|--global)
test $# -gt 1 && add_global "${@:2}" && echo
show_global
;;
*)
add_local "$@"
;;
esac
fi
# parse flags and args
level="none"
action="none"
declare -a args
while [ $# -gt 0 ]; do
case "$1" in
-h|--help)
_usage
exit 0
;;
-l|--local)
level="local"
;;
-g|--global)
level="global"
;;
-p|--private)
level="private"
;;
-e|--edit)
action="edit"
;;
-r|--remove)
action="remove"
;;
--)
shift
args+=("$@")
break
;;
*)
args+=("$1")
;;
esac
shift
done
# compatible with previous version
if [ "$action" = "none" ]; then
case "$level" in
local)
test ${#args[@]} -ne 0 && add_local "${args[@]}" && echo
show_local
;;
global)
test ${#args[@]} -ne 0 && add_global "${args[@]}" && echo
show_global
;;
private)
test ${#args[@]} -ne 0 && add_private "${args[@]}" && echo
show_private
;;
none)
add_local "${args[@]}"
# maybe show_local here too?
;;
esac
exit 0
# open file in editor
elif [ "$action" = "edit" ]; then
case "$level" in
local|none)
cd_to_git_root --warn
edit_file 'local' .gitignore && echo
;;
global)
global_gitignore="$(global_ignore)"
edit_file global "$global_gitignore" && echo
;;
private)
cd_to_git_root --error
test -d "${GIT_DIR}/info" || mkdir -p "${GIT_DIR}/info"
edit_file private "${GIT_DIR}/info/exclude" && echo
;;
esac
exit 0
# remove entries
else
if [ ${#args[@]} -eq 0 ]; then
echo "Nothing to remove."
exit 0
fi
case "$level" in
local|none)
cd_to_git_root --warn
remove_patterns 'local' .gitignore "${args[@]}" && echo
show_local
;;
global)
global_gitignore="$(global_ignore)"
remove_patterns global "$global_gitignore" "${args[@]}" && echo
show_global
;;
private)
cd_to_git_root --error
remove_patterns private "${GIT_DIR}/info/exclude" "${args[@]}" && echo
show_private
;;
esac
exit 0
fi
fi

151
bin/git-ignore-io Executable file
View file

@ -0,0 +1,151 @@
#!/usr/bin/env bash
gitignore_io_url="https://www.toptal.com/developers/gitignore/api/"
default_path="$HOME/.gi_list"
if [[ -n "$XDG_CACHE_HOME" ]]; then
default_path="$XDG_CACHE_HOME/git-extras/gi_list"
mkdir -p "$XDG_CACHE_HOME/git-extras"
fi
update_gi_list() {
curl -L -s "${gitignore_io_url}/list" > "$default_path"
}
print_in_alphabetical_order() {
local first_character previous_first_character ignorable
local first=true
for ignorable in $(echo "$gi_list" | sort);
do
first_character=${ignorable:0:1}
if [[ $first_character = "$previous_first_character" ]]; then
printf " %s" "$ignorable"
elif [[ $first = true ]]; then
previous_first_character=$first_character
first=false
printf "%s" "$ignorable"
else
previous_first_character=$first_character
printf "\n%s" "$ignorable"
fi
done
echo
}
print_in_table_format() {
echo "$gi_list" | column
}
search() {
for type in $gi_list;
do
if [[ "$type" == *$1* ]]
then
echo "$type"
fi
done
}
print_last_modified_time() {
if ! gi_list_date=$(stat -c "%y" "$default_path" 2> /dev/null); then
if ! gi_list_date=$(stat -f "%t%Sm" "$default_path" 2> /dev/null); then
if ! gi_list_date=$(date -r "$default_path" +%s 2> /dev/null); then
gi_list_date=0
fi
fi
fi
echo "Last update time: $gi_list_date"
}
gi() {
curl -L -s $gitignore_io_url/"$1"
}
gi_replace() {
gi "$1" > .gitignore
}
gi_append() {
gi "$1" >> .gitignore
}
show_usage() {
echo "Usage:"
echo " git ignore-io <types>... Show gitignore template"
echo " [-a|--append] <types>... Append new .gitignore content to .gitignore under the current directory"
echo " [-r|--replace] <types>... Export new .gitignore to the current directory (The old one will be replaced)"
echo " [-l|--list-in-table] Print available types in table format"
echo " [-L|--list-alphabetically] Print available types in alphabetical order "
echo " [-s|--search] <word> Search word in available types"
echo " [-t|--show-update-time] Show the last modified time of $default_path (where the list of available types is stored)"
echo " [-u|--update-list] Update $default_path"
}
check_list_exist() {
if ! [ -f "$default_path" ]; then
echo "-----Initial gitignore.io list----"
update_gi_list
echo "-----Save to $default_path-----"
echo
fi
gi_list=$(tr "," "\n" < "$default_path" 2>/dev/null)
}
check_list_exist
if [[ $# -eq 0 ]]; then
show_usage
else
case $1 in
-a|--append|-r|--replace)
opt=$1
shift
if [[ $# -eq 0 ]]; then
echo "There should be at least one type"
echo
show_usage
exit
fi
gi_to_curl=$(echo "$@" | tr " " ",")
case $opt in
-a|--append)
gi_append "$gi_to_curl"
;;
-r|--replace)
gi_replace "$gi_to_curl"
;;
esac
exit
;;
-t|--show-update-time)
print_last_modified_time
;;
-u|--update-list)
update_gi_list
;;
-s|--search)
opt=$1
shift
if [[ $# -eq 0 ]]; then
show_usage
exit
fi
search "$1"
;;
-L|--list-alphabetically)
print_in_alphabetical_order
;;
-l|--list-in-table)
print_in_table_format
;;
-*)
echo No Such option
show_usage
;;
*)
gi_to_curl=$(echo "$@" | tr " " ",")
gi "$gi_to_curl"
;;
esac
fi

View file

@ -1,11 +1,40 @@
#!/bin/sh
#!/usr/bin/env bash
GREEN="$(tput setaf 2)"
NORMAL="$(tput sgr0)"
if [ "$1" = "--color" ] || [ "$2" = "--color" ] || \
[ "$1" = "-c" ] || [ "$2" = "-c" ] ; then
COLOR_TITLE="$GREEN"
else
COLOR_TITLE="$NORMAL"
fi
HIDE_CONFIG=
if [ "$1" != "--no-config" ] && [ "$2" != "--no-config" ]; then
HIDE_CONFIG=1
fi
get_config() {
git config --list
cmd_get_config="$(git config --get-all git-extras.info.config-grep)"
if [ -z "$cmd_get_config" ]; then
git config --list
else
eval "$cmd_get_config"
fi
}
most_recent_commit() {
git log --max-count=1 --pretty=short
cmd_get_log="$(git config --get-all git-extras.info.log)"
if [ -z "$cmd_get_log" ]; then
git log --max-count=1 --pretty=short
else
eval "$cmd_get_log"
fi
}
submodules() {
# short sha1
git submodule status | sed 's/\([^abcdef0-9]\{0,2\}\)\([abcdef0-9]\{7\}\)\([abcdef0-9]\{33\}\)\(.*\)/\1\2\4/'
}
local_branches() {
@ -20,23 +49,31 @@ remote_urls() {
git remote -v
}
# Show info similar to svn
echon() {
echo "$@"
echo
}
echo
echo -e "## Remote URLs:\n"
echo -e "$(remote_urls)\n"
echon "${COLOR_TITLE}## Remote URLs:${NORMAL}"
echon "$(remote_urls)"
echo -e "## Remote Branches:\n"
echo -e "$(remote_branches)\n"
echon "${COLOR_TITLE}## Remote Branches:${NORMAL}"
echon "$(remote_branches)"
echo -e "## Local Branches:\n"
echo -e "$(local_branches)\n"
echon "${COLOR_TITLE}## Local Branches:${NORMAL}"
echon "$(local_branches)"
echo -e "## Most Recent Commit:\n"
echo -e "$(most_recent_commit)\n"
echo -e "Type 'git log' for more commits, or 'git show <commit id>' for full commit details.\n"
if test "$1" != "--no-config"; then
echo -e "## Configuration (.git/config):\n"
echo -e "$(get_config)\n"
SUBMODULES_LOG=$(submodules)
if [ -n "$SUBMODULES_LOG" ]; then
echon "${COLOR_TITLE}## Submodule(s):${NORMAL}"
echon "$SUBMODULES_LOG"
fi
echon "${COLOR_TITLE}## Most Recent Commit:${NORMAL}"
echon "$(most_recent_commit)"
if [ -n "$HIDE_CONFIG" ]; then
echon "${COLOR_TITLE}## Configuration (.git/config):${NORMAL}"
echon "$(get_config)"
fi

View file

@ -1,60 +0,0 @@
#!/usr/bin/env bash
project=${PWD##*/}
#
# list the last modified author for each line
#
function single_file {
while read data
do
if [[ $(file $data) = *text ]]; then #
git blame --line-porcelain $data | sed -n 's/^author //p';
fi
done
}
#
# list the author for all file
#
function lines {
git ls-files | single_file
}
#
# count the line count
#
function count {
lines | wc -l
}
#
# sort by author modified lines
#
function authors {
lines | sort | uniq -c | sort -rn
}
#
# list as percentage for author modified lines
#
function result {
authors | awk '
{ args[NR] = $0; sum += $0 }
END {
printf " %-9s: %i\n", "lines", sum
printf " %-9s: \n", "authors"
for (i = 1; i <= NR; ++i) {
printf " %-30s %2.1f%%\n", args[i], 100 * args[i] / sum
}
}
'
}
# summary
echo
echo " project : $project"
result
echo

View file

@ -1,6 +1,3 @@
#!/bin/sh
#!/usr/bin/env bash
ref=$(git symbolic-ref HEAD)
branch=${ref#refs/heads/}
git log origin/${branch}..${branch} $*
git log "@{upstream}..@" "$@"

View file

@ -1,5 +1,5 @@
#!/bin/sh
#!/usr/bin/env bash
filename=$1
test -z $filename && echo "filename required." 1>&2 && exit 1
git update-index --skip-worktree $filename
filename="$1"
test -z "$filename" && echo "filename required." 1>&2 && exit 1
git update-index --skip-worktree "$filename"

3
bin/git-locked Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
git ls-files -v | grep ^S | sed -e 's|S ||'

87
bin/git-magic Executable file
View file

@ -0,0 +1,87 @@
#!/usr/bin/env bash
# Bash unofficial strict mode
set -eo pipefail
IFS=$'\n\t'
cd "$(git rev-parse --show-toplevel)"
USAGE='git-magic [-a] [-m msg] [-e] [-p] [-f]'
ALL=false
PUSH=false
FORCE=''
ARGS=()
while getopts "m:eapfh" arg; do
case "${arg}" in
m)
ARGS+=("-m")
ARGS+=("${OPTARG}")
;;
e)
ARGS+=("-e")
;;
a)
ALL=true
;;
p)
PUSH=true
;;
f)
FORCE='--force-with-lease'
;;
h)
echo "$USAGE"
exit 0
;;
?)
echo "${USAGE}"
exit 1
;;
esac
done
shift $((OPTIND-1))
if [[ $# != 0 ]]; then
echo "Unknown arguments: $*"
echo "${USAGE}"
exit 1
fi
set -- "${ARGS[@]}" # restore positional parameters
if [[ $ALL == true ]]; then
# Check if there is no changes to stage
if [[ -z $(git status --porcelain) ]]; then
echo "No changes to commit"
exit 0
fi
# Get confirmation from user
git status
echo "Everything will be added"
read -rp "Press enter to continue"
# Restore staging area so that, for example,
# add and modify will not be separate entries in status
git restore --staged . || true
git add .
fi
# Commit with generated message
git commit --no-edit "$@" -m "$(git status --porcelain -uno)"
if [[ $PUSH == true ]]; then
git push $FORCE
fi
# --no-edit by default. use option -e to override this
# Arguments are passed with quoted "$@" to avoid misparsing
# Generated message comes after user provided arguments
# so that user can insert title before it

48
bin/git-merge-into Executable file
View file

@ -0,0 +1,48 @@
#!/usr/bin/env bash
current_branch() {
git rev-parse --abbrev-ref HEAD
}
usage() {
echo "Usage: git merge-into [src] dest [--ff-only]"
}
cur_branch=$(current_branch)
stashed=0
if [ -n "$(git status --porcelain)" ];
then
echo "Local modifications detected, stashing"
stashed=1
git stash
fi
if [ "${!#}" = '--ff-only' ]; then
case $# in
2 ) # dest --ff
git push "$(git rev-parse --show-toplevel)" "$cur_branch":"$1";;
3 )
git push "$(git rev-parse --show-toplevel)" "$1":"$2";;
* )
usage
esac
else
case $# in
1 )
git checkout "$1"
git merge "$cur_branch" "$1" && git checkout "$cur_branch"
;;
2 )
git checkout "$2"
git merge "$1" "$2" && git checkout "$cur_branch"
;;
* )
usage
esac
fi
if [ $stashed -eq 1 ];
then
git stash pop;
fi

25
bin/git-merge-repo Executable file
View file

@ -0,0 +1,25 @@
#!/usr/bin/env bash
repo=$1
branch=$2
prefix=$3
flat=0
if test "$prefix" = "."; then
prefix=$(mktemp -u 'git-merge-repo.XXXXXXX')
flat=1
fi
git subtree add -P "$prefix" "$repo" "$branch" "${@:4}"
message=$(git log -1 --pretty=%B)
if test $flat -eq 1; then
git stash -u
mv -i "$prefix"/* ./
git undo
git add .
git commit -am "$message"
git stash apply
rm -drf "$prefix"
fi

View file

@ -1,21 +1,52 @@
#!/bin/sh
#!/usr/bin/env bash
# grab first two non-option arguments
for arg in $*; do
if [[ $arg != -* ]]; then
test -z "$firstbranch" && firstbranch=$arg && continue
test -z "$secondbranch" && secondbranch=$arg && continue
else
# add anything else to a passthrough
passthrough="$passthrough $arg"
fi
done
usage() {
echo 1>&2 "usage: git missing [<first branch>] <second branch> [<git log options>] [[--] <path>...]"
}
test -z "$firstbranch" && echo "at least one branch required" && exit 1
if test -z "$secondbranch"; then
secondbranch=$firstbranch
firstbranch=
if [ "${#}" -lt 1 ]
then
usage
exit 1
fi
git log $passthrough $firstbranch...$secondbranch --format="%m %h %s" --left-right
declare -a git_log_args=()
declare -a branches=()
declare -a pathspec=()
declare parse_path=false
for arg in "$@" ; do
if [[ $parse_path == true ]]; then
pathspec+=("$@")
break
fi
case "$arg" in
--)
parse_path=true
;;
--*)
git_log_args+=( "$arg" )
;;
*)
branches+=( "$arg" )
;;
esac
done
firstbranch=
secondbranch=
if [ ${#branches[@]} -eq 2 ]
then
firstbranch="${branches[0]}"
secondbranch="${branches[1]}"
elif [ ${#branches[@]} -eq 1 ]
then
secondbranch="${branches[0]}"
else
echo >&2 "error: at least one branch required"
exit 1
fi
git log "${git_log_args[@]}" "$firstbranch"..."$secondbranch" --format="%m %h %s" --left-right -- "${pathspec[@]}"

36
bin/git-mr Executable file
View file

@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -eu
if [ -z "${1-}" ] ; then
echo "mr number or URL required. See --help for usage." 1>&2
exit 1
fi
remote_ref_kind=merge-requests
if test "$1" = "clean"; then
git for-each-ref refs/heads/mr/* --format='%(refname)' | while read -r ref; do
git branch -D "${ref#refs/heads/}"
done
exit 0
elif [[ $1 =~ ^(https?://[^/]+/(.+))/merge_requests/([0-9]+).*$ ]]; then
remote=${BASH_REMATCH[1]}.git
id=${BASH_REMATCH[3]}
elif [[ $1 =~ ^(https?://[^/]+/(.+))/pulls/([0-9]+).*$ ]]; then
# Forgejo/Codeberg pull request URL, e.g.
# https://codeberg.org/owner/repository/pulls/453
remote=${BASH_REMATCH[1]}.git
id=${BASH_REMATCH[3]}
remote_ref_kind=pull
else
id=$1
remote=${2:-origin}
fi
branch=mr/$id
remote_ref=refs/$remote_ref_kind/$id/head
git fetch -fu "$remote" "$remote_ref:$branch"
git checkout "$branch"
git config --local --replace "branch.$branch.merge" "$remote_ref"
git config --local --replace "branch.$branch.remote" "$remote"

View file

@ -1,4 +1,23 @@
#!/bin/sh
file="$1"
#!/usr/bin/env bash
file=""
range=""
for i in "$@"
do
# use '--' to separate file list and rev-list arguments
test "$i" == '--' && shift && break
file="$file"' '"$i"
shift
done
test -n "$*" && range=("$@")
test -z "$file" && echo "file required." 1>&2 && exit 1
git filter-branch -f --index-filter "git rm -r --cached '$file' --ignore-unmatch" --prune-empty --tag-name-filter cat -- --all
if [ -z "${range[*]}" ]
then
git filter-branch -f --index-filter "git rm -r --cached ""$file"" --ignore-unmatch" \
--prune-empty --tag-name-filter cat -- --all
else
# $range is an array so that we can forward multiple rev-list arguments
git filter-branch -f --index-filter "git rm -r --cached ""$file"" --ignore-unmatch" \
--prune-empty --tag-name-filter cat -- "${range[@]}"
fi

11
bin/git-paste Executable file
View file

@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -e
set -o pipefail
if ! command -v pastebinit &>/dev/null; then
echo >&2 "To run 'git paste', you need to install pastebinit in your system"
exit 1
fi
test $# -ne 0 || set -- '@{u}'
git format-patch --stdout "$@" | pastebinit -f diff

View file

@ -1,11 +1,77 @@
#!/bin/sh
# Based on https://gist.github.com/gnarf/5406589
#!/usr/bin/env bash
# Based on https://gist.github.com/gnarf/5406589 and https://gist.github.com/jhnns/d654d9d6da6d3b749986
TO_MERGE=
pull() {
local remote="$1"
local id="$2"
local branch="$3"
local ref="refs/pull/$id/head"
if [ -n "$TO_MERGE" ]; then
ref="refs/pull/$id/merge"
fi
git fetch -fu "$remote" "$ref:$branch" && \
git checkout "$branch" && \
git config --local --replace "branch.$branch.merge" "$ref" && \
git config --local --replace "branch.$branch.remote" "$remote"
}
pull_pr_if_matched() {
if [[ $1 =~ ^(.*):([0-9]+)|(https?://[^/]+/.+)/pull/([0-9]+).*$ ]]; then
if [[ -n ${BASH_REMATCH[2]} ]]; then
remote="${BASH_REMATCH[1]:-origin}"
id="${BASH_REMATCH[2]}"
else
remote="${BASH_REMATCH[3]}.git"
id="${BASH_REMATCH[4]}"
fi
branch=pr/$id
pull "$remote" "$id" "$branch"
return $?
fi
echo "$1 doesn't match the pr id pattern."
return 1
}
for arg in "$@"; do
case "$arg" in
-m|--merge)
TO_MERGE=1
;;
*)
# set the argument back
set -- "$@" "$arg"
;;
esac
shift
done
test -z "$1" && echo "pr number required." 1>&2 && exit 1
if test "$1" = "clean"; then
git for-each-ref refs/heads/pr/* --format='%(refname)' | while read ref; do
git branch -D ${ref#refs/heads/}
git for-each-ref refs/heads/pr/* --format='%(refname)' | while read -r ref; do
git branch -D "${ref#refs/heads/}"
done
elif [[ "$1" =~ ^[0-9]+$ ]]; then
remote_pref=${2:-$(git config --get git-extras.pr.remote)}
remote=${remote_pref:-origin}
id=$1
branch=pr/$id
pull "$remote" "$id" "$branch"
else
test -z $1 && echo "pr number required." 1>&2 && exit 1
git fetch -fu ${2:-origin} refs/pull/$1/head:pr/$1 && git checkout pr/$1
rc=1
while [ "$1" != "" ]; do
pull_pr_if_matched "$1"
rc=$?
shift
done
exit "$rc"
fi

83
bin/git-psykorebase Executable file
View file

@ -0,0 +1,83 @@
#!/usr/bin/env bash
PROGRAM=$0
PRIMARY_BRANCH=""
SECONDARY_BRANCH=""
FF="--ff"
CONTINUE="no"
current_branch() {
git rev-parse --abbrev-ref HEAD
}
function usage()
{
echo "USAGE: ${PROGRAM} PRIMARY_BRANCH [SECONDARY_BRANCH] [--no-ff]"
echo "USAGE: ${PROGRAM} --continue"
echo ""
echo "OPTIONS:"
echo " --no-ff: Force rebase commit."
echo " -c|--continue: Continue after the user updates conflicts."
}
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
--no-ff)
FF="--no-ff"
;;
-c|--continue)
CONTINUE=yes
;;
*)
if [[ "$PRIMARY_BRANCH" == "" ]]; then
PRIMARY_BRANCH=$key
elif [[ "$SECONDARY_BRANCH" == "" ]]; then
SECONDARY_BRANCH=$key
else
usage
exit 20 # Error during arguments parsing
fi
;;
esac
shift # past argument or value
done
if [[ "$SECONDARY_BRANCH" == "" ]]; then
SECONDARY_BRANCH=$(current_branch)
fi
if [[ "$CONTINUE" == "yes" ]]; then
TARGET_BRANCH=$(current_branch)
SECONDARY_BRANCH=${TARGET_BRANCH%"-rebased-on-top-of-"*}
PRIMARY_BRANCH=${TARGET_BRANCH#*"-rebased-on-top-of-"}
if [[ "${SECONDARY_BRANCH}-rebased-on-top-of-${PRIMARY_BRANCH}" != $TARGET_BRANCH ]]; then
echo "Couldn't continue rebasing on ${TARGET_BRANCH}"
exit 30 # Impossible to detect PRIMARY_BRANCH AND SECONDARY_BRANCH
fi
echo "Continuing rebasing of $SECONDARY_BRANCH on top of $PRIMARY_BRANCH"
git commit || exit 51
git branch -d "${SECONDARY_BRANCH}" || exit 52
git branch -m "${TARGET_BRANCH}" "${SECONDARY_BRANCH}" || exit 53
elif [[ "$PRIMARY_BRANCH" == "" ]]; then
usage
exit 10 # Missing arguments PRIMARY_BRANCH
else
echo "Rebasing $SECONDARY_BRANCH on top of $PRIMARY_BRANCH"
TARGET_BRANCH="${SECONDARY_BRANCH}-rebased-on-top-of-${PRIMARY_BRANCH}"
git checkout "${PRIMARY_BRANCH}" || exit 41
git checkout -b "${TARGET_BRANCH}" || exit 42
if git merge "${SECONDARY_BRANCH}" ${FF} \
-m "Psycho-rebased branch ${SECONDARY_BRANCH} on top of ${PRIMARY_BRANCH}"; then
git branch -d "${SECONDARY_BRANCH}" || exit 43
git branch -m "${TARGET_BRANCH}" "${SECONDARY_BRANCH}" || exit 44
else
echo "Resolve the conflict and run ``${PROGRAM} --continue``."
exit 1
fi
fi

View file

@ -5,7 +5,7 @@
#
abort() {
echo $@
echo >&2 "$@"
exit 1
}
@ -14,51 +14,72 @@ abort() {
#
json() {
local title="${1//\"/\\\"}"
local body="${2//\"/\\\"}"
local head="${3//\"/\\\"}"
local base="${4//\"/\\\"}"
cat <<EOF
{
"title": "$1",
"body": "$2",
"head": "$3",
"base": "$4"
}
"title": "$title",
"body": "$body",
"head": "$head",
"base": "$base"
}
EOF
}
# user
# personal access token
# config name is github-personal-access-token '_' is not allowed in git config
user=$(git config --global user.email)
test -z "$user" && abort "git config user.email required"
github_personal_access_token=$(git config --default "$GITHUB_TOKEN" git-extras.github-personal-access-token)
test -z "$github_personal_access_token" && abort "GITHUB_TOKEN or git config git-extras.github-personal-access-token required"
# branch
branch=${1-$(git symbolic-ref HEAD | sed 's/refs\/heads\///')}
remote=$(git config branch."$branch".remote)
if [ -z "$remote" ]; then
echo 'no upstream found, push to origin as default'
remote="origin"
fi
[ "$remote" = "." ] && abort "the upstream should be a remote branch."
# make sure it's pushed
git push origin $branch || abort "failed to push $branch"
git push "$remote" "$branch" || abort "failed to push $branch"
# lame hack to get project
project=$(git config remote.origin.url | sed 's/^.*://' | sed 's/\.git$//')
remote_url=$(git config remote."$remote".url)
if [[ "$remote_url" == git@* ]]; then
project=${remote_url##*:}
else
project=${remote_url#https://*/}
fi
project=${project%.git}
# prompt
echo
echo " create pull-request for $project '$branch'"
echo
printf " title: " && read title
printf " body: " && read body
printf " base [master]: " && read base
printf " title: " && read -r title
printf " body: " && read -r body
printf " base [%s]: " "$(git_extra_default_branch)" && read -r base
printf " GitHub two-factor authentication code (leave blank if not set up): " && read -r mfa_code
echo
# create pull request
if [ -z "$base" ]
then
base="master"
base="$(git_extra_default_branch)"
fi
body=$(json "$title" "$body" $branch "$base")
curl -u "$user" "https://api.github.com/repos/$project/pulls" -d "$body"
body=$(json "$title" "$body" "$branch" "$base")
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token $github_personal_access_token" \
-H "X-GitHub-OTP: $mfa_code" \
"https://api.github.com/repos/$project/pulls" -d "$body"

161
bin/git-reauthor Executable file
View file

@ -0,0 +1,161 @@
#!/usr/bin/env bash
init_variables() {
COMMAND=${0#*-}
CONFIG=false
ALL=false
unset OLD_EMAIL
unset CORRECT_EMAIL
unset CORRECT_NAME
TYPE='both'
}
usage() {
cat << EOF
usage: git ${COMMAND} [<options>]
Options
-a, --all rewrite all identities in commits and tags
-c, --use-config define correct values from user Git config
-e, --correct-email <email> define the correct email to set
-n, --correct-name <name> define the correct name to set
-o, --old-email <email> rewrite identities matching old email in commits and tags
-t, --type <id> define the type of identities affected by the rewrite
author, committer, both (default)
EOF
}
error() {
if [[ -n "$1" ]]; then
local msg=$( echo "error: $1" | sed 's/\\n/\\n /g' )
echo -e "${msg}" >&2
fi
usage
exit 1
}
reauthor() {
local author='
if ${ALL} || [ "${GIT_AUTHOR_EMAIL}" = "${OLD_EMAIL}" ]; then
[ -z "${CORRECT_EMAIL+x}" ] || export GIT_AUTHOR_EMAIL="${CORRECT_EMAIL}"
[ -z "${CORRECT_NAME+x}" ] || export GIT_AUTHOR_NAME="${CORRECT_NAME}"
fi
'
local committer='
if ${ALL} || [ "${GIT_COMMITTER_EMAIL}" = "${OLD_EMAIL}" ]; then
[ -z "${CORRECT_EMAIL+x}" ] || export GIT_COMMITTER_EMAIL="${CORRECT_EMAIL}"
[ -z "${CORRECT_NAME+x}" ] || export GIT_COMMITTER_NAME="${CORRECT_NAME}"
fi
'
local filter
case "${TYPE}" in
author) filter="${author}" ;;
committer) filter="${committer}" ;;
both) filter="${author} ${committer}" ;;
esac
export ALL
export OLD_EMAIL
export CORRECT_EMAIL
export CORRECT_NAME
git filter-branch --force --env-filter "${filter}" \
--tag-name-filter cat -- --branches --tags
}
parse_options() {
while [[ "$#" -gt 0 ]]; do
case "$1" in
--all|-a)
ALL=true
shift
;;
--correct-email|-e)
[[ -n "${2+x}" ]] || error 'Missing correct-email value'
CORRECT_EMAIL="$2"
shift 2
;;
-h)
usage
exit 0
;;
--correct-name|-n)
[[ -n "${2+x}" ]] || error 'Missing correct-name value'
CORRECT_NAME="$2"
shift 2
;;
--old-email|-o)
[[ -n "${2+x}" ]] || error 'Missing old-email value'
OLD_EMAIL="$2"
shift 2
;;
--type|-t)
[[ -n "${2+x}" ]] || error 'Missing type value'
TYPE="$2"
shift 2
;;
--use-config|-c)
CONFIG=true
shift
;;
*)
error "invalid option '$1'"
;;
esac
done
if ${CONFIG}; then
# use config values if not explicitly already defined
[[ -n "${CORRECT_EMAIL+x}" ]] || CORRECT_EMAIL=$( git config user.email )
[[ -n "${CORRECT_NAME+x}" ]] || CORRECT_NAME=$( git config user.name )
fi
}
validate_options() {
# Either OLD_EMAIL should be set or ALL should be true
if [[ -z "${OLD_EMAIL+x}" ]] && ! ${ALL}; then
msg="missing target of the rewrite"
msg="${msg}\nuse either --old-email option or --all flag"
error "${msg}"
fi
# OLD_EMAIL shouldn't be set if ALL is true as well to prevent misuse
if [[ -n "${OLD_EMAIL+x}" ]] && ${ALL}; then
msg="ambiguous target of the rewrite"
msg="${msg}\nuse either --old-email option or --all flag"
error "${msg}"
fi
# CORRECT_NAME should be either unset or set to non-empty string
[[ -n "${CORRECT_NAME-x}" ]] || error "empty name is not allowed"
# Either CORRECT_EMAIL or CORRECT_NAME should be set
if [[ -z "${CORRECT_EMAIL+x}" ]] && [[ -z "${CORRECT_NAME+x}" ]]; then
msg="missing correct email and/or name to set"
msg="${msg}\nuse --correct-email and/or --correct-name options"
msg="${msg}\nor --use-config flag with user values set in Git config"
error "${msg}"
fi
# TYPE should be a valid identifier
if [[ "${TYPE}" != 'both' ]] \
&& [[ "${TYPE}" != 'author' ]] \
&& [[ "${TYPE}" != 'committer' ]]; then
error "invalid type '${TYPE}'"
fi
}
init_variables
parse_options "$@"
validate_options
reauthor

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env bash
# Warn on a dirty work tree.
git rev-parse --verify HEAD >/dev/null || exit 1
@ -15,28 +15,28 @@ then
fi
# Use a temporary index.
index="/tmp/$(basename $0).$$.tmp"
index=$(git_extra_mktemp)
cleanup() {
rm $index
rm "$index"
exit 2
}
trap cleanup 2
trap cleanup INT
# Go back in history while parent commits are available.
echo "Trying to find a commit the patch applies to..."
rev=$(git rev-parse HEAD)
while [ $? = 0 ]
do
GIT_INDEX_FILE=$index git read-tree $rev
GIT_INDEX_FILE=$index git read-tree "$rev"
# Try to apply the patch.
GIT_INDEX_FILE=$index git apply --cached $1 >/dev/null 2>&1
GIT_INDEX_FILE=$index git apply --cached "$1" &>/dev/null
patch_failed=$?
# Do it again, but show the error, if the problem is the patch itself.
if [ $patch_failed = 128 ]
then
GIT_INDEX_FILE=$index git apply --index --check $1
GIT_INDEX_FILE=$index git apply --index --check "$1"
exit $patch_failed
fi
@ -45,19 +45,19 @@ do
then
# Manufacture a commit.
tree=$(GIT_INDEX_FILE=$index git write-tree)
commit=$(git commit-tree $tree -p $rev -m "$1")
rm $index
commit=$(git commit-tree "$tree" -p "$rev" -m "$1")
rm "$index"
echo "Patch applied to $(git rev-parse --short $rev) as $(git rev-parse --short $commit)"
echo "Patch applied to $(git rev-parse --short "$rev") as $(git rev-parse --short "$commit")"
git cherry-pick $commit
git cherry-pick "$commit"
exit $?
fi
rev=$(git rev-parse --verify -q $rev^)
rev=$(git rev-parse --verify -q "$rev^")
done
# No compatible commit found. Restore.
echo "Failed to find a commit the patch applies to."
rm $index
rm "$index"
exit 1

View file

@ -1,16 +0,0 @@
#!/bin/sh
# Removed unnecessary git checkout for bug, feature and refactor
if test "$1" = "finish"; then
test -z $2 && echo "refactor <name> required." 1>&2 && exit 1
branch=refactor/$2
git merge --no-ff $branch && git delete-branch $branch
else
test -z $1 && echo "refactor <name> required." 1>&2 && exit 1
if test -n "$2"; then
echo "too many arguments; if not finishing a refactor, only <name> of new refactoring is expected" && exit 1
fi
branch=refactor/$1
git checkout -b $branch &> /dev/null
test -n $? && git checkout $branch &> /dev/null
fi

View file

@ -1,21 +1,137 @@
#!/usr/bin/env sh
#!/usr/bin/env bash
set -e
hook() {
local hook=.git/hooks/$1.sh
if test -f $hook; then
# compat without extname
if test ! -f "$hook"; then
hook=.git/hooks/$1
fi
if test -f "$hook"; then
echo "... $1"
. $hook
shift
if test -x "$hook"; then
$hook "$@"
else
. "$hook" "$@"
fi
fi
}
exit_with_msg() {
>&2 echo "$1"
exit 1
}
if test $# -gt 0; then
hook pre-release
echo "... releasing $1"
git commit -a -m "Release $1"
git tag $1 -a -m "Release $1" \
&& git push $2 \
&& git push $2 --tags \
&& hook post-release \
remote=''
# check for flags
while test $# != 0
do
case "$1" in
-c) need_changelog=true;;
-r) remote=$2; shift ;;
-m) msg=$2; shift ;;
-s)
test -n "$keyid" &&
exit_with_msg "Please use '-s' OR '-u'"
sign=true
;;
-u)
test -n "$sign" &&
exit_with_msg "Please use '-s' OR '-u'"
keyid=$2
shift
;;
--semver)
test -z "$2" &&
exit_with_msg "major/minor/patch required for --semver option"
semver=$2
shift
;;
--prefix)
test -z "$2" &&
exit_with_msg "prefix string required for --prefix option"
prefix="$2"
shift
;;
--no-empty-commit) no_empty_commit=true;;
--) shift; hook_args="$hook_args $*"; break;;
*) test -z "$version" && version=$1 ;;
esac
shift
done
if [ -n "$semver" ]; then
if [ -z "$(git tag)" ]; then
echo "there is no tag in the git repo" 1>&2
exit 1
fi
latest_tag=$(git describe --tags "$(git rev-list --tags --max-count=1)")
if [[ ! "$latest_tag" =~ \
^$prefix([^0-9]*)([1-9][0-9]+|[0-9])\.([1-9][0-9]+|[0-9])\.([1-9][0-9]+|[0-9])(.*) ]]; then
echo "the latest tag doesn't match semver format requirement" 1>&2
exit 1
fi
case "$semver" in
major ) version="${BASH_REMATCH[2]}" ;;
minor ) version="${BASH_REMATCH[3]}" ;;
patch ) version="${BASH_REMATCH[4]}" ;;
* ) echo "invalid semver argument given: $semver" 1>&2
exit 1
;;
esac
(( ++version ))
case "$semver" in
major ) version="$prefix${BASH_REMATCH[1]}$version.0.0${BASH_REMATCH[5]}" ;;
minor ) version="$prefix${BASH_REMATCH[1]}${BASH_REMATCH[2]}.$version.0${BASH_REMATCH[5]}" ;;
patch ) version="$prefix${BASH_REMATCH[1]}${BASH_REMATCH[2]}.${BASH_REMATCH[3]}.$version${BASH_REMATCH[5]}" ;;
esac
fi
hook_args="$version"
if [ -z "$msg" ]; then
msg="Release ${version}"
fi
# shellcheck disable=SC2086
hook pre-release $hook_args \
|| exit_with_msg "pre-release hook failed! Cancelling release."
echo "... releasing $version"
if [ "$need_changelog" = true ]; then
git-changelog -t "$version"
fi
if [ "$no_empty_commit" = true ]; then
git commit -a -m "$msg" || true
else
git commit -a -m "$msg" --allow-empty
fi
declare -a sign_args
if [ "$sign" = true ]; then
sign_args=("-s")
fi
if [ -n "$keyid" ]; then
sign_args=("-u" "$keyid")
fi
# shellcheck disable=SC2086
git tag "${sign_args[@]}" $version -a -m "$msg" \
&& git push $remote --tags \
&& git push $remote \
&& hook post-release $hook_args \
&& echo "... complete"
else
echo "tag required" 1>&2 && exit 1

23
bin/git-rename-branch Executable file
View file

@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -e
# Assert there is at least one branch provided
test -z "$1" && echo "new branch name required." 1>&2 && exit 1
if [ -z "$2" ]; then
new_branch="$1"
old_branch="$(git symbolic-ref --short -q HEAD)"
else
new_branch="$2"
old_branch="$1"
fi
remote=$(git config branch."$old_branch".remote; true)
git branch -m "$old_branch" "$new_branch"
# check if the branch is tracking a remote branch
if [[ -n "$remote" && "$remote" != "." ]]
then
git push "$remote" :"$old_branch"
git push --set-upstream "$remote" "$new_branch"
fi

101
bin/git-rename-file Executable file
View file

@ -0,0 +1,101 @@
#!/usr/bin/env bash
set -euo pipefail
# Usage function
usage() {
cat <<EOF
Usage: git rename-file [OPTIONS] <source> <destination>
Description:
Rename a file or directory and ensure Git recognizes the change, regardless of filesystem case-sensitivity.
It combines the functionality of the "mv" command and "git mv". This is particularly useful for renaming files or directories
to change only their case, which might not be detected by Git on case-insensitive filesystems.
Options:
-h, --help Show this help message and exit.
Examples:
git rename-file old_filename new_filename
git rename-file old_directory new_directory
EOF
}
# Check for help option
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
usage
exit 0
fi
# Check for correct number of arguments
if [ "$#" -ne 2 ]; then
echo "Error: Incorrect number of arguments."
echo ""
usage >&2
exit 1
fi
# Assign variables
SOURCE="$1"
DESTINATION="$2"
TEMP_NAME="${SOURCE}.temp"
# Function to check if a file or directory exists in a case-sensitive manner
check_case_sensitive_exists() {
local path="$1"
local dir
local base
dir=$(dirname "$path")
base=$(basename "$path")
if [ -e "$dir" ]; then
if (cd "$dir" && find . -maxdepth 1 -name "$base" | grep -q "$base"); then
return 0
fi
fi
return 1
}
# Check if source exists and is under version control
if ! check_case_sensitive_exists "$SOURCE"; then
echo "Error: Source '$SOURCE' does not exist."
exit 1
fi
if ! git ls-files --error-unmatch "$SOURCE" > /dev/null 2>&1; then
echo "Error: Source '$SOURCE' is not under version control. If file or directory is new, it must at least be staged."
exit 1
fi
# Check if destination already exists
if check_case_sensitive_exists "$DESTINATION"; then
echo "Error: Destination '$DESTINATION' already exists."
exit 1
fi
# Check if the destination directory exists
DEST_DIR=$(dirname "$DESTINATION")
if ! check_case_sensitive_exists "$DEST_DIR"; then
echo "Error: Destination directory '$DEST_DIR' does not exist."
exit 1
fi
# Create a rollback function
rollback() {
echo "Rolling back changes..."
if [ -e "$TEMP_NAME" ]; then
git mv -f "$TEMP_NAME" "$SOURCE"
fi
}
# Trap errors to trigger rollback
trap 'rollback' ERR
# Move the file to a temporary name within the Git repository
git mv "$SOURCE" "$TEMP_NAME"
# Move the temporary file to the desired destination
git mv "$TEMP_NAME" "$DESTINATION"
echo "Successfully renamed '$SOURCE' to '$DESTINATION'."

20
bin/git-rename-remote Executable file
View file

@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -euo pipefail
old=$1
new=$2
test -z "$old" && echo "old remote name required." 1>&2 && exit 1
test -z "$new" && echo "new remote name required." 1>&2 && exit 1
if ! git config --get "remote.$old.fetch" > /dev/null; then
echo "remote $old doesn't exist"
exit 1
fi
if git config --get "remote.$new.fetch" > /dev/null; then
git remote remove "$new"
fi
git remote rename "$old $new"
git remote -v

View file

@ -1,12 +1,12 @@
#!/bin/sh
#!/usr/bin/env bash
old=$1
new=$2
test -z $old && echo "old tag name required." 1>&2 && exit 1
test -z $new && echo "new tag name required." 1>&2 && exit 1
test -z "$old" && echo "old tag name required." 1>&2 && exit 1
test -z "$new" && echo "new tag name required." 1>&2 && exit 1
git tag $new $old
git tag -d $old
git push origin $new
git push origin :refs/tag/$old
git tag "$new" "$old"
git tag -d "$old"
git push origin "$new"
git push origin ":refs/tags/$old"

View file

@ -1,43 +1,99 @@
#!/usr/bin/env bash
shopt -s extglob
git version
echo "git-extras version ""$(git-extras -v)"
echo "type 'ls' to ls files below current directory, '!command' to execute any command or just 'subcommand' to execute any git subcommand"
echo "Type 'ls' to ls files below current directory; '!command' to execute any command or just 'subcommand' to execute any git subcommand; 'quit', 'exit', 'q', ^D, or ^C to exit the git repl."
HISTIGNORE=${HISTIGNORE:-+([[:space:]])}
HISTCONTROL=${HISTCONTROL:-ignoredups}
use_local_history=$(git config --get --default 'false' git-extras.repl.use-local-history)
if [[ "$use_local_history" == "true" ]]; then
HISTFILE="$(git rev-parse --show-toplevel)/.git_extras_repl_history"
else
HISTFILE=${XDG_STATE_HOME:-$HOME/.local/state}/git_extras_repl_history
fi
# file doesn't exist, is empty, or contains only whitespace
if [[ ! -f "$HISTFILE" ]] || [[ ! -s "$HISTFILE" ]] || ! grep -q '[^[:space:]]' "$HISTFILE"; then
# `history -r` .... `history -a` are not happy with an empty initial file in bash 3.2.57, which is what MacOS 26 ships with
echo '!echo welcome to git-repl!' >> "$HISTFILE"
fi
history -r
while true; do
# Current branch
cur=`git symbolic-ref HEAD 2> /dev/null | cut -d/ -f3-`
cur=$(git symbolic-ref HEAD 2> /dev/null | cut -d/ -f3-)
# Prompt
if test -n "$cur"; then
prompt="git ($cur)> "
cur_string=" ($cur)"
else
prompt="git> "
cur_string=""
fi
if test -n "$exit_status" && test "$exit_status" -ne 0; then
es_string=$' \e[31m['"$exit_status"$']\e[0m'
else
es_string=""
fi
prompt_character=$(git config --get --default '>' git-extras.repl.prompt-character)
prefix=$(git config --get --default 'git' git-extras.repl.prefix)
show_project_name=$(git config --get --default 'false' git-extras.repl.show-project-name)
if [[ "$show_project_name" == "true" ]]; then
project_name=" $(basename "$(git rev-parse --show-toplevel)" .git)"
else
project_name=""
fi
# Readline
read -e -r -p "$prompt" cmd
prompt_base="$prefix$project_name$cur_string$es_string$prompt_character"
prompt_base_stripped=$(echo "$prompt_base" | awk '{$1=$1};1')
prompt="$prompt_base_stripped "
# EOF
test $? -ne 0 && break
# Use arguments as a command if any are provided.
if [ $# -ne 0 ]; then
cmd=$*
set --
echo "$prompt" "$cmd" # It is as though you had entered a command.
else
# Readline
read -e -r -p "$prompt" cmd
# Check for EOF, and end the program if so (handles ^D).
test $? -ne 0 && break
fi
# History
history -s "$cmd"
# Add command to history if it is not all whitespace
if [[ ! "$cmd" =~ ^[[:space:]]*$ ]]; then
history -s "$cmd"
fi
# Built-in commands
case $cmd in
ls) cmd=ls-files;;
"") continue;;
quit) break;;
"")
on_enter_cmd=$(git config --get --default '' git-extras.repl.on-enter-command)
if test -n "$on_enter_cmd"; then
cmd="$on_enter_cmd"
else
continue
fi
;;
quit|exit|q) break;;
esac
history -a
if [[ $cmd == !* ]]; then
eval ${cmd:1}
# shellcheck disable=SC2086
eval ${cmd:1}
elif [[ $cmd == git* ]]; then
# shellcheck disable=SC2086
eval $cmd
else
eval git "$cmd"
fi
exit_status=$?
done
echo

View file

@ -1,17 +1,17 @@
#!/bin/sh
#!/usr/bin/env bash
file="$1"
commit="$2"
if [[ -f $file ]]; then
git rm --cached -q -f -- $file
if [[ -z $commit ]]; then
git checkout HEAD -- $file
git rm --cached -q -f -- "$file"
if [[ -z $commit ]]; then
git checkout HEAD -- "$file"
echo "Reset '$1' to HEAD"
else
git checkout $commit -- $file
git checkout "$commit" -- "$file"
echo "Reset '$1' to $commit"
fi
else
echo "File '$1' not found in `pwd`"
else
echo "File '$1' not found in $PWD"
fi

30
bin/git-root Executable file
View file

@ -0,0 +1,30 @@
#!/usr/bin/env bash
git_root() {
git rev-parse --show-toplevel
}
# get the relative path of current path according to root of repo
git_root_relative() {
rel=$(git rev-parse --show-prefix)
if [ -z "$rel" ]; then
# git rev-parse --show-prefix will output empty string when we are in the root dir
echo "."
else
echo "$rel"
fi
}
if test $# -eq 0; then
git_root
else
case "$1" in
-r|--relative)
git_root_relative
;;
*)
git_root
;;
esac
fi

1
bin/git-rscp Symbolic link
View file

@ -0,0 +1 @@
git-scp

267
bin/git-scp Executable file
View file

@ -0,0 +1,267 @@
#!/usr/bin/env bash
COLOR_RED() { test -t 1 && echo -n "$(tput setaf 1)"; }
COLOR_GREEN() { test -t 1 && echo -n "$(tput setaf 2)"; }
COLOR_YELLOW(){ test -t 1 && echo -n "$(tput setaf 3)"; }
COLOR_BLUE() { test -t 1 && echo -n "$(tput setaf 4)"; }
COLOR_RESET() { test -t 1 && echo -n "$(tput sgr 0)"; }
function _test_git_scp()
{
command -v rsync > /dev/null || _error requires rsync
command -v git > /dev/null || _error requires git
command -v ssh > /dev/null || _error requires ssh
command -v php > /dev/null || _info optional php
command -v dos2unix > /dev/null || _info optional dos2unix
}
function set_remote()
{
remote=$1
if [ "$(git remote | grep -c -- "^$remote$")" -eq 0 ]
then
COLOR_RED
echo "Remote $remote does not exist in your git config"
COLOR_RESET
exit 1
fi
}
# Check file for PHP syntax errors
# takes a list of filenames
function php_lint()
{
local error_count=()
for i
do
# check if file exists
# check if file ends with ".php"
test ! -f "$i" && continue
case "$i" in
*\.php|*\.phtml)
if ! php -l "$i" > /dev/null; then
error_count[${#error_count[@]}]="$i"
fi
;;
esac
done
# syntax check fails, force exit
test ${#error_count[@]} -gt 0 &&
COLOR_RED &&
echo "Error: ${#error_count[@]} PHP syntax error found" &&
echo "${error_count[@]}" | tr " " '\n' &&
COLOR_RESET &&
exit 255
return 0
}
function _dos2unix()
{
command -v dos2unix > /dev/null && dos2unix "$@"
return 0
}
function _sanitize()
{
git config --get-all extras.scp.sanitize | while read -r i
do
case $i in
php_lint) php_lint "$@";; # git config --global --add extras.scp.sanitize php_lint
dos2unix) _dos2unix "$@";; # git config --global --add extras.scp.sanitize dos2unix
esac
done
return $?
}
function scp_and_stage
{
local verbose=0 interactive=0 dry_run=0
while :
do
case "$1" in
-v|--verbose) verbose=1; shift;;
-i|--interactive) verbose=1; interactive=1; shift;;
-n|--dry-run) verbose=1; dry_run=1; shift;;
*) break;;
esac
done
set_remote "$1"
shift
local refhead
refhead="$(git rev-parse --quiet --verify "$1")"
if [ -n "$refhead" ]
then
shift
[ "$(git branch --contains "$refhead" | grep -c '\*')" -eq 0 ] &&
_error "refhead provided is not part of current branch"
fi
if [ $# -ge 1 ]
then
list=$(git ls-files "$@")" "$(git ls-files -o "$@")
elif [ -n "$refhead" ]
then
[ "$verbose" -eq 1 ] && git --no-pager diff --stat "$refhead"
list=$(git diff "$refhead" --name-only)
else
[ "$verbose" -eq 1 ] && git --no-pager diff
list=$(git diff --name-only)
fi
deleted=$(for i in $list; do [ -f "$i" ] || echo "$i"; done)
list=$(for i in $list; do [ -f "$i" ] && echo "$i"; done)
if [ "$interactive" -eq 1 ] && [ "$dry_run" -eq 0 ] && { [ -n "$list" ] || [ -n "$deleted" ]; }
then
local reply
read -r -p "Proceed with sync to $remote? [y/N] " reply
case "$reply" in
y|Y|yes|YES) ;;
*) _info "Aborted, nothing synced."; exit 0;;
esac
fi
local status=0
if [ -n "$list" ]
then
local _TMP=${0///}
# shellcheck disable=SC2086
echo "$list" > "$_TMP"
if [ "$dry_run" -eq 1 ] || _sanitize $list
then
_info "Pushing to $remote ($(git config "remote.$remote.url"))"
if [ "$dry_run" -eq 1 ]
then
rsync -rlDvn --files-from="$_TMP" ./ "$(git config "remote.$remote.url")/"
else
rsync -rlDv --files-from="$_TMP" ./ "$(git config "remote.$remote.url")/" &&
git add --force $list
fi
status=$?
else
status=1
fi
rm "$_TMP"
fi
deleted=$(for i in $deleted; do echo "$(git config "remote.$remote.url" | cut -d: -f2)/$i"; done)
if [ -n "$deleted" ]
then
COLOR_RED
echo Deleted remote files
if [ "$dry_run" -eq 1 ]
then
echo "$deleted"
else
if ssh "$(git config "remote.$remote.url" | cut -d: -f1)" -t "rm $deleted"
then
echo "$deleted"
else
status=1
fi
fi
COLOR_RESET
fi
return "$status"
}
function reverse_scp()
{
local verbose=0 interactive=0 dry_run=0
while :
do
case "$1" in
-v|--verbose) verbose=1; shift;;
-i|--interactive) verbose=1; interactive=1; shift;;
-n|--dry-run) verbose=1; dry_run=1; shift;;
*) break;;
esac
done
set_remote "$1"
shift
local _TMP=${0///}
echo "$@" > "$_TMP"
local status=0
if [ "$verbose" -eq 1 ]
then
rsync -rlDvn --files-from="$_TMP" "$(git config "remote.$remote.url")/" ./
status=$?
fi
if [ "$dry_run" -eq 1 ]
then
rm "$_TMP"
return "$status"
fi
if [ "$interactive" -eq 1 ]
then
local reply
read -r -p "Proceed with copy from $remote? [y/N] " reply
case "$reply" in
y|Y|yes|YES) ;;
*) _info "Aborted, nothing copied."; rm "$_TMP"; exit 0;;
esac
fi
rsync -rlDv --files-from="$_TMP" "$(git config "remote.$remote.url")/" ./ &&
rm "$_TMP"
}
function _info()
{
COLOR_YELLOW
test $# -gt 0 && echo "$@"
COLOR_RESET
}
function _usage()
{
echo "Usage:
git scp -h|help|?
git scp [options] <remote> [ref|file..] # scp and stage your files to specified remote
git scp [options] <remote> [<ref>] # show diff relative to <ref> and upload unstaged files to <remote>
git rscp [options] <remote> [<file|directory>] # copy <remote> files to current working directory
OPTIONS:
-v, --verbose print what will be synced before syncing
-i, --interactive prompt for confirmation before syncing (implies --verbose)
-n, --dry-run show what would be synced, change nothing (implies --verbose; no staging, no remote writes/deletes)
"
case $1 in
-v|verbose|--verbose) grep -A100 '^#* OPTIONS #*$' "$0" ;;
esac
exit
}
function _error()
{
[ $# -eq 0 ] && _usage && exit 0
echo
echo "ERROR: $*"
echo
exit 1
}
### OPTIONS ###
case $(basename "$0") in
git-scp)
case $1 in
''|-h|'?'|help|--help) shift; _test_git_scp; _usage "$@";;
*) scp_and_stage "$@";;
esac
;;
git-rscp) reverse_scp "$@";;
esac

104
bin/git-sed Executable file
View file

@ -0,0 +1,104 @@
#!/usr/bin/env bash
usage() {
cat <<EOF
usage: git sed [ -c ] [ -f <flags> ] <search> <replacement> [ <flags> ]
Run git grep and then send results to sed for replacement with the
given flags, if they are provided via -f or as the third argument.
Also runs git commit if -c is provided.
EOF
}
# don't commit by default
do_commit() {
true
}
pathspec=
while [ "$1" != "" ]; do
case "$1" in
-c|--commit)
if git status --porcelain | grep .; then
echo "you need to commit your changes before running with --commit"
exit 1
fi
do_commit() {
git commit -m"replace $search with $replacement
actual command:
$command" -a
}
;;
-f|--flags)
if [ "$2" = "" ]; then
usage
echo "missing argument for $1"
exit 1
fi
shift
flags=$1
;;
-h|--help)
usage
exit
;;
--)
pathspec="$*"
break
;;
-*)
usage
echo "unknown flag: $1"
exit 1
;;
*)
if [ "$search" = "" ]; then
search="$1"
elif [ "$replacement" = "" ]; then
replacement="$1"
elif [ "$flags" = "" ]; then
flags="$1"
else
usage
echo "too many arguments: $1"
exit 1
fi
;;
esac
shift
done
all="$search$replacement$flags"
case "$all" in
*/*)
ascii="$(for((i=32;i<=127;i++)) do printf '%b' "\\$(printf '%03o' "$i")"; done)"
escaped="${all//-/\\-}"
escaped="${escaped//[/\\[}"
sep="$(printf '%s' "$ascii" | tr -d "$escaped")"
sep="$(printf %.1s "$sep")"
if [ "$sep" = "" ] ; then
echo 'could not find an unused character for sed separator character'
exit 1
fi
;;
*)
sep=/
;;
esac
r=$(xargs -r false < /dev/null > /dev/null 2>&1 && echo r)
need_bak=$(sed -i s/hello/world/ "$(git_extra_mktemp)" > /dev/null 2>&1 || echo true)
if [ "$need_bak" ]; then
command="git grep -lz '$search' $pathspec | xargs -0$r sed -i '' 's$sep$search$sep$replacement$sep$flags'"
# shellcheck disable=SC2086
git grep -lz "$search" $pathspec | xargs -0"$r" sed -i '' "s$sep$search$sep$replacement$sep$flags"
else
command="git grep -lz '$search' $pathspec | xargs -0$r sed -i 's$sep$search$sep$replacement$sep$flags'"
# shellcheck disable=SC2086
git grep -lz "$search" $pathspec | xargs -0"$r" sed -i "s$sep$search$sep$replacement$sep$flags"
fi
do_commit

View file

@ -1,4 +1,11 @@
#!/bin/sh
#!/usr/bin/env bash
COMMIT_MESSAGE='Initial commit'
if [ "$1" = "-m" ]; then
COMMIT_MESSAGE=$2
shift; shift
fi
gitdirexists(){
if [ -d ".git" ]; then
@ -13,4 +20,4 @@ mkdir -p "$dir" \
&& gitdirexists \
&& git init \
&& git add . \
&& git commit -m 'Initial commit'
&& git commit --allow-empty -m "$COMMIT_MESSAGE"

3
bin/git-show-merged-branches Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
git branch --no-color --merged | grep -v "\*" | grep -v "$(git_extra_default_branch)" | tr -d ' '

View file

@ -1,3 +1,3 @@
#!/bin/sh
#!/usr/bin/env bash
git log --all --graph --decorate --oneline --simplify-by-decoration

3
bin/git-show-unmerged-branches Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
git branch --no-color --no-merged | grep -v "\*" | grep -v "$(git_extra_default_branch)" | tr -d ' '

View file

@ -1,7 +1,26 @@
#!/bin/bash
#!/usr/bin/env bash
SQUASH_MSG=
for arg in "$@"; do
case "$arg" in
--squash-msg)
SQUASH_MSG=1
;;
*)
# set the argument back
set -- "$@" "$arg"
;;
esac
shift
done
src="$1"
msg="$2"
if [[ -n "$msg" ]] && [[ -n "$SQUASH_MSG" ]]; then
>&2 echo "When commit message is given, --squash-msg is not allowed."
exit 1
fi
is_branch() {
git show-ref --verify --quiet "refs/heads/$src"
@ -12,9 +31,10 @@ is_commit_reference() {
}
is_on_current_branch() {
local commit_sha=`git rev-parse "$src"`
local commit_sha
commit_sha=$(git rev-parse "$src")
git rev-list HEAD |
grep -q "$commit_sha"
grep -q -- "$commit_sha"
}
commit_if_msg_provided() {
@ -23,8 +43,8 @@ commit_if_msg_provided() {
fi
}
prompt_continuation_if_squashing_master() {
if [[ $src =~ ^master$ ]]; then
prompt_continuation_if_squashing_default_branch() {
if [[ $src == $(git_extra_default_branch) ]]; then
read -p "Warning: squashing '$src'! Continue [y/N]? " -r
if ! [[ $REPLY =~ ^[Yy]$ ]]; then
echo "Exiting"
@ -34,19 +54,26 @@ prompt_continuation_if_squashing_master() {
}
squash_branch() {
prompt_continuation_if_squashing_master
prompt_continuation_if_squashing_default_branch
if [ -n "$SQUASH_MSG" ]; then
base=$(git merge-base "$src" @)
msg=$(git log "$base".."$src" --format="%s%n%n%b" --no-merges --reverse)
fi
git merge --squash "$src" || exit 1 # quits if `git merge` fails
commit_if_msg_provided
}
squash_current_branch() {
if [ -n "$SQUASH_MSG" ]; then
msg=$(git log "$src"..@ --format="%s%n%n%b" --no-merges --reverse)
fi
git reset --soft "$src" || exit 1 # quits if `git reset` fails
commit_if_msg_provided
}
if `is_branch`; then
if is_branch; then
squash_branch
elif `is_commit_reference` && `is_on_current_branch`; then
elif is_commit_reference && is_on_current_branch; then
squash_current_branch
else
echo "Source branch or commit reference required." 1>&2 && exit 1

91
bin/git-stamp Executable file
View file

@ -0,0 +1,91 @@
#!/usr/bin/env bash
init_variables() {
COMMAND=${0#*-}
REPLACE=false
unset ID
unset MSG
}
usage() {
cat << EOF
usage: git ${COMMAND} [<options>] <id> [<messages>]
Options:
-r, --replace replace all previous stamps with same id
EOF
}
error() {
if [[ -n "$1" ]]; then
echo "error: $1" >&2
fi
usage
exit 1
}
stamp() {
local commit_msg=$( git log -1 --pretty=%B )
local stamp_msg
[[ -n "${MSG}" ]] && stamp_msg="${ID} ${MSG}" || stamp_msg="${ID}"
if ${REPLACE}; then
# remove previous stamps with same ID from the commit message
commit_msg=$(
echo "${commit_msg}" \
| grep --ignore-case --invert-match "^${ID}\b" \
| cat -s
)
fi
# append the stamp to the commit message in a new paragraph
git commit --amend \
--message "${commit_msg}" \
--message "${stamp_msg}" \
> /dev/null
# show result
git log -1 --pretty=full
}
parse_options() {
while [[ "$#" -gt 0 ]]; do
case "$1" in
-h)
usage
exit 0
;;
--replace|-r)
REPLACE=true
shift
;;
*)
break
;;
esac
done
ID="$1"
MSG="${*:2}"
}
validate_options() {
# ID should be set to non-empty string
if [[ -z "${ID}" ]]; then
error "missing stamp identifier"
fi
}
init_variables
parse_options "$@"
validate_options
stamp

301
bin/git-standup Executable file
View file

@ -0,0 +1,301 @@
#!/usr/bin/env bash
# Code modified from https://github.com/kamranahmedse/git-standup,
# under the MIT LICENSE.
usage() {
cat <<EOS
Usage:
git standup [-a <author name>] [-w <weekstart-weekend>|-d <days-ago>] [-m <max-dir-depth>] [-D date-format] [-L] [-h] [-f] [-B] [-n <number-of-commits] [-F <gpg|authordate>]
-a - Specify author to restrict search to, default to current git user.
Use "-a all" if you don't want the restriction.
-w - Specify weekday range to limit search to
-m - Specify the depth of recursive directory search
-L - Toggle inclusion of symbolic links in recursive directory search
-d - Specify the number of days back to include
-D - Specify the date format for "git log" (default: relative)
-h - Display this help screen
-f - Fetch the latest commits beforehand
-B - Display the commits in branch groups
-n - Limit the number of commits displayed per group
-F gpg - Show if commit is GPG signed (G) or not (N)
-F authordate - Print author date instead of commit date
Examples:
git standup -a "John Doe" -w "MON-FRI" -m 3
EOS
}
warn() {
>&2 echo "${BOLD}${RED}WARNING: $1${NORMAL}"
}
git rev-parse --show-toplevel > /dev/null 2>&1
in_git_repo=$?
# Use colors, but only if connected to a terminal, and that terminal
# supports them.
if command -v tput &>/dev/null; then
ncolors=$(tput colors)
fi
if [[ -t 1 ]] && [[ -n "$ncolors" ]] && [[ "$ncolors" -ge 8 ]] ; then
RED="$(tput setaf 1)"
GREEN="$(tput setaf 2)"
YELLOW="$(tput setaf 3)"
BOLD="$(tput bold)"
NORMAL="$(tput sgr0)"
BOLD=$(tput bold)
UNDERLINE=$(tput smul)
NORMAL=$(tput sgr0)
COLOR=always
else
RED=""
GREEN=""
YELLOW=""
BOLD=""
NORMAL=""
BOLD=""
UNDERLINE=""
NORMAL=""
COLOR=never
fi
# Only enable exit-on-error after the non-critical colorization stuff,
# which may fail on systems lacking tput or terminfo
set -e
RANGE_SPECIFIED=
COMMIT_DATE_FORMAT=%cd
USE_GPG_FORMAT=no
while getopts "hgfF:Bd:a:w:m:D:n:L" opt; do
case $opt in
h)
usage
exit 0
;;
a)
if [[ "$OPTARG" = 'all' ]] ; then
AUTHOR=".*"
else
AUTHOR="$OPTARG"
fi
;;
d)
test -n "$RANGE_SPECIFIED" && warn "-d option is conflict with -w"
RANGE_SPECIFIED=yes
if [ "$OPTARG" -lt 1 ]; then
>&2 echo "Specify days less than one is invalid"
exit 1
fi
SINCE="$OPTARG days ago"
;;
w)
if [ -n "$RANGE_SPECIFIED" ]; then
warn "-w option is conflict with -d"
continue
fi
RANGE_SPECIFIED=yes
week_range=${OPTARG}
week_start="${week_range%%-*}"
week_start="${week_start:="Mon"}"
week_end="${week_range##*-}"
week_end=${week_end:="Fri"}
## In case it is the start of week, we need to
## show the commits since the last weekend
shopt -s nocasematch
if [[ "$week_start" == "$(LC_ALL=C date +%a)" ]] ; then
SINCE="last $week_end";
fi
;;
f)
FETCH_LAST_COMMIT=true
;;
m)
MAXDEPTH=$((OPTARG + 1))
if [ "$MAXDEPTH" -lt 1 ]; then
>&2 echo "Specify depth less than one is invalid"
exit 1
fi
;;
L)
INCLUDE_LINKS=-L
;;
D)
GIT_DATE_FORMAT=${OPTARG}
;;
g)
warn "-g option is deprecated, use '-F gpg' instead"
USE_GPG_FORMAT=yes
;;
B)
GROUP_BY_BRANCHES=true
;;
n)
MAX_COMMIT_NUM=${OPTARG}
;;
F)
case $OPTARG in
gpg)
USE_GPG_FORMAT=yes
;;
authordate)
COMMIT_DATE_FORMAT=%ad
;;
*)
warn "Invalid argument for -F: $OPTARG"
usage
exit 1
;;
esac
;;
\?)
usage
exit 1
;;
esac
done
shift $((OPTIND-1))
if [[ $# -gt 0 ]]; then
warn "please upgrade to new-style interface. Run 'git help standup' to get more info."
if [[ $# -gt 3 ]] ; then
usage
exit 1
fi
AUTHOR=$1
SINCE=$2
UNTIL=$3
fi
AUTHOR=${AUTHOR:="$(git config user.name || echo '')"}
if [ -z "${AUTHOR}" ]; then
warn "please configure an author with 'git config user.name' or specify an author via '-a'"
exit 1
fi
FETCH_LAST_COMMIT=${FETCH_LAST_COMMIT:=false}
MAXDEPTH=${MAXDEPTH:=2}
GIT_PRETTY_FORMAT="%Cred%h%Creset - %s %Cgreen(${COMMIT_DATE_FORMAT}) %C(bold blue)<%an>%Creset"
GIT_DATE_FORMAT=${GIT_DATE_FORMAT:=relative}
if [[ "$USE_GPG_FORMAT" == 'yes' ]]; then
GIT_PRETTY_FORMAT="$GIT_PRETTY_FORMAT %C(yellow)gpg: %G?%Creset"
fi
# Handle config of implicit week
IMPLICIT_WEEK=$(git config --get git-extras.standup.implicit-week || echo '')
if [[ -z "$RANGE_SPECIFIED" ]] && [[ -n "${IMPLICIT_WEEK}" ]]; then
week_start=${IMPLICIT_WEEK%%-*}
week_end=${IMPLICIT_WEEK##*-}
shopt -s nocasematch
if [[ "$week_start" == "$(LC_ALL=C date +%a)" ]]; then
SINCE="last $week_end"
fi
UNTIL=today
else
SINCE=${SINCE:=yesterday}
UNTIL=${UNTIL:=today}
fi
GIT_LOG_COMMAND="git --no-pager log \
--no-merges
--since \"$SINCE\"
--until \"$UNTIL\"
--author=\"$AUTHOR\"
--abbrev-commit
--oneline
--color=$COLOR
--pretty=format:'$GIT_PRETTY_FORMAT'
--date='$GIT_DATE_FORMAT'"
if [[ -n "$MAX_COMMIT_NUM" ]]; then
GIT_LOG_COMMAND="$GIT_LOG_COMMAND --max-count=$MAX_COMMIT_NUM"
fi
git_output() {
if [ "$GROUP_BY_BRANCHES" = true ]; then
local branches
branches=$(git branch --sort=-committerdate | awk '{print substr($0, 3)}')
for branch in $branches; do
# shellcheck disable=SC2086
if output=$(eval $GIT_LOG_COMMAND "$branch"); then
if [[ -n "$output" ]] ; then
echo "${GREEN}${branch}${NORMAL}"
echo "$output"
echo ""
fi
fi
# TODO optimize:return if the latest commit of a branch is earlier than the 'since' day
done
else
# shellcheck disable=SC2086
eval $GIT_LOG_COMMAND --all
fi
}
## For when the command has been run in a non-repo directory
if [[ $in_git_repo != 0 ]]; then
## Set delimiter to newline for the loop
IFS=$'\n'
## Recursively search for git repositories
# shellcheck disable=SC2086
PROJECT_DIRS=$(find $INCLUDE_LINKS . -maxdepth "$MAXDEPTH" -mindepth 0 -name .git)
# Fetch the latest commits, if required
if [ "$FETCH_LAST_COMMIT" = true ]; then
echo "${BOLD}${GREEN}Fetching commits ..${NORMAL}"
# Foreach of the project directories, fetch the commits
for DIR in $PROJECT_DIRS; do
DIR="$(dirname "$DIR")"
pushd "$DIR" > /dev/null
if [[ -d ".git" ]] ; then
echo " ${YELLOW}$(basename "$DIR")${NORMAL}"
git fetch --all > /dev/null 2>&1
fi
popd > /dev/null
done
fi
# Get the standup details for each of the projects
for DIR in $PROJECT_DIRS; do
DIR="$(dirname "$DIR")"
pushd "$DIR" > /dev/null
## Show the detail only if it is a git repository
if [[ -d ".git" || -f ".git" ]] ; then
if GITOUT=$(git_output); then
## Only output if there is some activities
if [[ -n "$GITOUT" ]] ; then
echo "${BOLD}${UNDERLINE}${YELLOW}$(basename "$DIR")${NORMAL}"
echo "$GITOUT"
echo ""
fi
else
echo "Repository under $DIR could not be queried." >&2
fi
fi
popd > /dev/null
done
else
if [ "$FETCH_LAST_COMMIT" = true ]; then
echo "${GREEN}Fetching commits ..${NORMAL}"
git fetch --all > /dev/null 2>&1
fi
if GITOUT=$(git_output); then
if [[ -n "$GITOUT" ]] ; then
echo "$GITOUT"
else
if [[ $AUTHOR = '.*' ]] ; then
AUTHOR="all the contributors"
fi
echo "${YELLOW}Seems like $AUTHOR did nothing!${NORMAL}"
fi
fi
fi

View file

@ -1,23 +1,81 @@
#!/bin/sh
#!/usr/bin/env bash
commit=""
test $# -ne 0 && commit=$@
project=${PWD##*/}
cd "$(git root)" || { echo "Can't cd to top level directory";exit 1; }
PROJECT_FULL_PATH=
SUMMARY_BY_LINE=
DEDUP_BY_EMAIL=
MERGES_ARG=
OUTPUT_STYLE=
for arg in "$@"; do
case "$arg" in
--full-path)
PROJECT_FULL_PATH=1
;;
--line)
SUMMARY_BY_LINE=1
;;
--dedup-by-email)
DEDUP_BY_EMAIL=1
;;
--no-merges)
MERGES_ARG="--no-merges"
;;
--output-style)
OUTPUT_STYLE="$2"
shift
;;
-*)
>&2 echo "unknown argument $arg found"
exit 1
;;
*)
# set the argument back
set -- "$@" "$arg"
;;
esac
shift
done
if [ -n "$DEDUP_BY_EMAIL" ] && [ -n "$SUMMARY_BY_LINE" ]; then
>&2 echo "--dedup-by-email used with --line is not supported"
exit 1
fi
if [ -n "$MERGES_ARG" ] && [ -n "$SUMMARY_BY_LINE" ]; then
>&2 echo "--no-merges used with --line is not supported"
exit 1
fi
commit="HEAD"
if [ -n "$SUMMARY_BY_LINE" ]; then
paths=( "$@" )
else
[ $# -ne 0 ] && commit=$*
fi
if [[ -n "$PROJECT_FULL_PATH" ]]; then
project=${PWD/${HOME}/\~}
else
project=${PWD##*/}
fi
#
# get date for the given <commit>
#
date() {
git log --pretty='format: %ai' $1 | cut -d ' ' -f 2
commit_date() {
# the $1 can be empty
# shellcheck disable=SC2086
git log $MERGES_ARG --pretty='format: %ai' "$1" | cut -d ' ' -f 2
}
#
# get active days for the given <commit>
#
active_days() {
date $1 | uniq | awk '
commit_date "$1" | sort -r | uniq | awk '
{ sum += 1 }
END { print sum }
'
@ -26,59 +84,176 @@ active_days() {
#
# get the commit total
#
commit_count() {
git log --oneline $commit | wc -l | tr -d ' '
# shellcheck disable=SC2086
git rev-list $MERGES_ARG --count "$commit"
}
#
# total file count
#
file_count() {
git ls-files | wc -l | tr -d ' '
}
#
# remove duplicate authors who belong to the same email address
#
dedup_by_email() {
# in:
# 27 luo zexuan <LuoZexuan@xxx.com>
# 7 罗泽轩 <luozexuan@xxx.com>
# out:
# 34 luo zexuan
LC_ALL=C awk '
{
sum += $1
last_field = tolower($NF)
if (last_field in emails) {
emails[last_field] += $1
} else {
email = last_field
emails[email] = $1
# set commits/email to empty
$1=$NF=""
sub(/^[[:space:]]+/, "", $0)
sub(/[[:space:]]+$/, "", $0)
name = $0
if (name in names) {
# when the same name is associated with existed email,
# merge the previous email into the later one.
emails[email] += emails[names[name]]
emails[names[name]] = 0
}
names[name] = email
}
}
END {
for (name in names) {
email = names[name]
printf "%6d\t%s\n", emails[email], name
}
}' | sort -rn -k 1
}
#
# list authors
#
authors() {
git shortlog -n -s $commit | awk '
format_authors() {
# a rare unicode character is used as separator to avoid conflicting with
# author name. However, Linux column utility will escape tab if separator
# specified, so we do unesaping after it.
LC_ALL=C awk '
{ args[NR] = $0; sum += $0 }
END {
for (i = 1; i <= NR; ++i) {
printf "%s,%2.1f%%\n", args[i], 100 * args[i] / sum
printf "%s%2.1f%%\n", args[i], 100 * args[i] / sum
}
}
' | column -t -s,
' | column -t -s♪ | sed "s/\\\x09/\t/g"
}
#
# fetch repository age from oldest commit
#
repository_age() {
git log --reverse --pretty=oneline --format="%ar" | head -n 1 | sed 's/ago//'
git log --reverse --pretty=oneline --format="%ar" | head -n 1 | LC_ALL=C sed 's/ago//'
}
# summary
#
# fetch repository age of the latest commit
#
last_active() {
git log --pretty=oneline --format="%ar" -n 1
}
if test "$1" = "--line"; then
git line-summary
echo
else
#
# list the last modified author for each line
#
single_file() {
while read -r data
do
if [[ $(file "$data") = *text* ]]; then
git blame --line-porcelain "$data" 2>/dev/null | grep "^author " | LC_ALL=C sed -n 's/^author //p';
fi
done
}
echo
echo " project : $project"
echo " repo age :" $(repository_age)
echo " active :" $(active_days) days
echo " commits :" $(commit_count)
if test "$commit" = ""; then
echo " files :" $(file_count)
current_branch_name() {
git rev-parse --abbrev-ref HEAD
}
#
# list the author for all file
#
lines() {
git ls-files -- "$@" | single_file
}
#
# get the number of the lines
#
line_count() {
lines "$@" | wc -l
}
uncommitted_changes_count() {
git status --porcelain | wc -l
}
COLUMN_CMD_DELIMTER="¬" # Hopefully, this symbol is not used in branch names... I use it as a separator for columns
SP="$COLUMN_CMD_DELIMTER|"
print_summary_by_line() {
if [ "$OUTPUT_STYLE" = "tabular" ]; then
tabular_headers="# Repo $SP Lines"
echo -e "$tabular_headers\n$project $SP $(line_count "${paths[@]}")" | column -t -s "$COLUMN_CMD_DELIMTER"
elif [ "$OUTPUT_STYLE" = "oneline" ]; then
echo "$project / lines: $(line_count "${paths[@]}")"
elif [ -n "$SUMMARY_BY_LINE" ]; then
echo
echo " project : $project"
echo " lines : $(line_count "${paths[@]}")"
echo " authors :"
lines "${paths[@]}" | sort | uniq -c | sort -rn | format_authors
fi
echo " authors : "
authors
echo
}
print_summary() {
if [ "$OUTPUT_STYLE" = "tabular" ]; then
tabular_headers="# Repo $SP Age $SP Last active $SP Active on $SP Commits $SP Uncommitted $SP Branch"
echo -e "$tabular_headers\n$project $SP $(repository_age) $SP $(last_active) $SP $(active_days "$commit") days $SP $(commit_count "$commit") $SP $(uncommitted_changes_count) $SP $(current_branch_name)" | column -t -s "$COLUMN_CMD_DELIMTER"
elif [ "$OUTPUT_STYLE" = "oneline" ]; then
echo "$project / age: $(repository_age) / last active: $(last_active) / active on $(active_days "$commit") days / commits: $(commit_count "$commit") / uncommitted: $(uncommitted_changes_count) / branch: $(current_branch_name)"
else
echo
echo " project : $project"
echo " repo age : $(repository_age)"
echo " branch: : $(current_branch_name)"
echo " last active : $(last_active)"
echo " active on : $(active_days "$commit") days"
echo " commits : $(commit_count "$commit")"
# The file count doesn't support passing a git ref so ignore it if a ref is given
if [ "$commit" = "HEAD" ]; then
echo " files : $(file_count)"
fi
echo " uncommitted : $(uncommitted_changes_count)"
echo " authors : "
if [ -n "$DEDUP_BY_EMAIL" ]; then
# the $commit can be empty
# shellcheck disable=SC2086
git shortlog $MERGES_ARG -n -s -e "$commit" | dedup_by_email | format_authors
else
# shellcheck disable=SC2086
git shortlog $MERGES_ARG -n -s "$commit" | format_authors
fi
fi
}
if [ -n "$SUMMARY_BY_LINE" ]; then
print_summary_by_line
else
print_summary
fi

101
bin/git-sync Executable file
View file

@ -0,0 +1,101 @@
#!/usr/bin/env bash
function _usage()
{
local command="git sync"
cat << EOS
Usage:
${command} [<remote> <branch>]
${command} -h | --help
${command} -s | --soft
${command} -f | --force
Sync local branch with <remote>/<branch>.
When <remote> and <branch> are not specified on the command line, upstream of local branch will be used by default.
All changes and untracked files and directories will be removed unless you add -s(--soft).
Examples:
Sync with upstream of local branch:
${command}
Sync with origin/master:
${command} origin master
Sync without cleaning untracked files:
${command} -s
Sync without interaction:
${command} -f
EOS
}
function main()
{
while [ "$1" != "" ]; do
case $1 in
-h | --help)
_usage
exit
;;
-s | --soft)
local soft="true"
;;
-f | --force)
local force="YES"
;;
* )
if [ "${remote}" = "" ]; then
local remote="$1"
elif [ "${branch}" = "" ]; then
local branch="$1"
else
echo -e "Error: too many arguments.\n"
_usage
exit 1
fi
;;
esac
shift
done
local remote_branch
if [ -z "${remote}" ]; then
if ! remote_branch="$(git rev-parse --abbrev-ref --symbolic-full-name '@{u}' 2>/dev/null)"; then
echo "There is no upstream information of local branch."
exit 1
fi
local branch="$(git rev-parse --abbrev-ref --symbolic-full-name @)"
local remote=$(git config "branch.${branch}.remote")
elif [ -z "${branch}" ]; then
echo -e "Error: too few arguments.\n"
_usage
exit 1
else
remote_branch="${remote}/${branch}"
fi
if [ "${force}" != "YES" ]; then
if [ "${soft}" = "true" ]; then
echo -n "Are you sure you want to sync with '${remote_branch}'? [y/N]: "
else
echo -n "Are you sure you want to clean all changes & sync with '${remote_branch}'? [y/N]: "
fi
local force
read -r force
fi
case "${force}" in
"Y" | "y" | "yes" | "Yes" | "YES" )
if [ "${soft}" = "true" ]; then
git fetch "${remote}" "${branch}" && git reset --hard "${remote_branch}"
else
git fetch "${remote}" "${branch}" && git reset --hard "${remote_branch}" && git clean -d -f -x
fi
;;
* )
echo "Canceled."
;;
esac
}
main "$@"

View file

@ -1,8 +1,13 @@
#!/bin/sh
#!/usr/bin/env bash
filename="$*"
USAGE(){
echo "git touch <filename> [ <filename> . . .]" 1>&2
exit 1
}
test -z "$filename" && echo "filename required" 1>&2 && exit 1
test $# -lt 1 && USAGE
touch "$filename" \
&& git add "$filename"
for filename in "$@"; do
touch "$filename" \
&& git add "$filename"
done

View file

@ -1,19 +1,72 @@
#!/bin/sh
#!/usr/bin/env bash
back="^"
cstr="commits"
ccnt=$(git rev-list --count HEAD)
if [ "$ccnt" -eq 1 ]; then cstr="commit"; fi
parm3=""
function _undo()
{
type=${1:-soft}
undo_cnt=${2:-1}
reset=${3:-""}
if [ "$undo_cnt" -gt "$ccnt" ]; then
echo "Only $ccnt $cstr, cannot undo $undo_cnt"
elif [ "$type" = "hard" ] && [ "$ccnt" -eq "$undo_cnt" ]; then
echo "Cannot hard undo all commits"
elif [ "$type" = "soft" ] && [ "$ccnt" -eq 1 ]; then
git update-ref -d HEAD
else
git reset "--$type" "HEAD~$undo_cnt"
fi
if [ "$reset" != "" ]; then git reset; fi
}
case "$1" in
-h|--hard)
test $2 -gt 1 > /dev/null 2>&1 && back="~$2"
git reset --hard HEAD$back && exit 0;
-h)
cat << EOL
This will erase any changes since your last commit.
If you want to get help info, run "git undo --help" instead.
Do you want to continue? [yN]"
EOL
read -r res
case "${res}" in
"Y" | "y")
parm1=hard
parm2=${2:-1}
;;
* )
exit 0
;;
esac
;;
--hard)
parm1=hard
parm2=${2:-1}
;;
-s|--soft)
test $2 -gt 1 > /dev/null 2>&1 && back="~$2"
parm1=soft
parm2=${2:-1}
parm3=reset
;;
"")
parm1=soft
parm2=1
;;
*[!0-9]*)
echo "Invalid parameter: $1"
exit 1
;;
*)
test $1 -gt 1 > /dev/null 2>&1 && back="~$1"
parm1=soft
parm2="$1"
;;
esac
git reset --soft HEAD$back
git reset
if [[ ! $parm2 =~ ^[1-9][0-9]*$ ]]; then
echo "Invalid undo count: $parm2"
exit 1
fi
_undo "$parm1" "$parm2" "$parm3"

View file

@ -1,5 +1,5 @@
#!/bin/sh
#!/usr/bin/env bash
filename=$1
test -z $filename && echo "filename required." 1>&2 && exit 1
git update-index --no-skip-worktree $filename
filename="$1"
test -z "$filename" && echo "filename required." 1>&2 && exit 1
git update-index --no-skip-worktree "$filename"

14
bin/git-unwip Executable file
View file

@ -0,0 +1,14 @@
#!/usr/bin/env bash
# Based on scripts from git-utils:
# * https://github.com/ddollar/git-utils/blob/master/git-unwip
# Check if the last commit is a 'WIP' commit
LAST_COMMIT=`git log -1 --pretty=%B | tr -d '[:space:]'`
if [ 'WIP' != $LAST_COMMIT ]; then
echo 'Last commit is not a WIP commit, so it will not be unWIP-ed.'
exit 1
fi
git undo --soft

131
bin/git-utimes Executable file
View file

@ -0,0 +1,131 @@
#!/usr/bin/env bash
#
# Change files modification time to their last commit date
#
# Bash unofficial strict mode
set -euo pipefail
IFS=$'\n\t'
if [[ "${1:-}" == "--newer" ]]; then
op=le
shift
else
op=eq
fi
# BSD systems
if date -j &>/dev/null; then
stat_flags="-f %m"
date_flags="-r"
else
# Non-BSD systems
stat_flags="-c %Y"
date_flags="-d@"
fi
bash_opts=()
if bash --help 2>&1 | grep -q -- '--noprofile'; then
bash_opts+=(--noprofile)
fi
if bash --help 2>&1 | grep -q -- '--norc'; then
bash_opts+=(--norc)
fi
status_opts=(--porcelain --short)
# %ct: committer date, UNIX timestamp / %at: author date, UNIX timestamp
log_opts=(--format='%ct')
if git status --help 2>&1 | grep -q -- "--no-renames"; then
status_opts+=(--no-renames)
log_opts+=(--no-renames)
fi
if git status --help 2>&1 | grep -q -- "--untracked-files"; then
status_opts+=(--untracked-files=no)
fi
if git status --help 2>&1 | grep -q -- "--ignored"; then
status_opts+=(--ignored=no)
fi
prefix="$(git rev-parse --show-prefix) "
strip="${#prefix}"
tmpfile=$(mktemp)
# shellcheck disable=SC2064
trap "rm -f '${tmpfile}'" 0
awk_flags=(
-F'\t'
-v date_flags="${date_flags}"
-v op="${op}"
-v stat_flags="${stat_flags}"
-v strip="${strip}"
-v tmpfile="${tmpfile}"
)
# sanity check, not required:
if awk --help 2>&1 | grep -q -- '--posix'; then
awk_flags+=(--posix)
fi
read -r -d '' awk_script <<"EOF" || true
BEGIN {
seen[""]=1
print "#!/usr/bin/env bash"
print "set +e"
print "t() {"
print " test -e \"$2\" || return 0"
printf(" test \"$(stat %s \"$2\" 2>/dev/null)\" -%s \"$1\" && return 0\n", stat_flags, op)
if (date_flags == "-d@") {
print " echo \"+ touch -h -d@$1 $2\""
print " touch -h -d@$1 \"$2\""
} else {
print " t=$(date -r$1 \"+%Y%m%d%H%M.%S\")"
print " echo \"+ touch -h -t $t $2\""
print " touch -h -t $t \"$2\""
}
print "}"
}
FILENAME==tmpfile {
skip[$1]=1
next
}
# skip blank lines
!/^$/ {
# skip deletes
if (substr($1, length($1), 1) ~ /D/) {
next
}
if (NF == 1) {
ct=$1
next
}
$2 = substr($2, strip, length($2)- strip + 1)
if ($2 in seen) {
next
}
if ($2 in skip) {
next
}
seen[$2]=1
# remove enclosing double quotes that git adds:
if (substr($2, 1, 1) == "\"" && substr($2, length($2), 1) == "\"") {
$2 = substr($2, 2, length($2) - 2)
# unescape remaining double quotes
gsub(/\\"/, "\"", $2)
# unescape escaped backslashes
gsub(/\\\\/, "\\", $2)
}
# escape apostrophes: ' => '\''
gsub(/'/, "'\\''", $2)
printf("t %s '%s'\n", ct, $2)
}
EOF
# prefix is stripped:
git --no-pager status "${status_opts[@]}" . \
| cut -c 4- >"${tmpfile}"
# prefix is not stripped:
git --no-pager log --raw --no-merges "${log_opts[@]}" . \
| awk "${awk_flags[@]}" "${awk_script}" "${tmpfile}" - \
| BASH_ENV='' bash "${bash_opts[@]}" -

8
bin/git-wip Executable file
View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
# Based on scripts from git-utils:
# * https://github.com/ddollar/git-utils/blob/master/git-wip
# * https://github.com/ddollar/git-utils/blob/master/git-addremove
git add --all
git commit --all --message="WIP"

Some files were not shown because too many files have changed in this diff Show more