Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't Repeat Yourself #107

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions doc/git-a/alias.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add
7 changes: 7 additions & 0 deletions doc/git-a/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Short for `git add`.

Example:

```shell
git a file.txt
```
2 changes: 2 additions & 0 deletions doc/git-a/git-a.gitconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[alias]
a = "add"
1 change: 1 addition & 0 deletions doc/git-aa/alias.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add --all
8 changes: 8 additions & 0 deletions doc/git-aa/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Short for "git add --all" (add all paths).

Example:

```shell
git aa
```

2 changes: 2 additions & 0 deletions doc/git-aa/git-aa.gitconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[alias]
aa = "add --all"
1 change: 1 addition & 0 deletions doc/git-add-alias/alias.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f() { if [ $# != 3 ]; then echo "Usage: git add-alias ( --local | --global ) <alias> <command>"; echo "Error: this command needs 3 arguments."; return 2; fi; if [ -n "$(git config "$1" --get alias."$2")" ]; then echo "Alias '$2' already exists, thus no change happened."; return 3; fi; git config "$1" alias."$2" "$3" && return 0; echo "Usage: git add-alias ( --local | --global ) <alias> <command>"; echo "Error: unknown failure."; return 1; }; f
8 changes: 8 additions & 0 deletions doc/git-add-alias/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Create a new Git alias.

Example:

```shell
git add-alias --local myalias mycommand
git add-alias --global myalias mycommand
```
1 change: 1 addition & 0 deletions doc/git-add-cached/alias.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git add "$(git ls-files --cached | sort -u)"
29 changes: 29 additions & 0 deletions doc/git-add-cached/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Add cached files.

Example:

```shell
git add-cached
```

Compare:

* [git add-cached](../git-add-cached) (this alias)
* [git add-deleted](../git-add-deleted)
* [git add-others](../git-add-others)
* [git add-ignored](../git-add-ignored)
* [git add-killed](../git-add-killed)
* [git add-modified](../git-add-modified)
* [git add-stage](../git-add-stage)
* [git add-unmerged](../git-add-unmerged)

Compare corresponding aliases for `edit-*`:

* [git edit-cached](../git-edit-cached)
* [git edit-deleted](../git-edit-deleted)
* [git edit-others](../git-edit-others)
* [git edit-ignored](../git-edit-ignored)
* [git edit-killed](../git-edit-killed)
* [git edit-modified](../git-edit-modified)
* [git edit-stage](../git-edit-stage)
* [git edit-unmerged](../git-edit-unmerged)
1 change: 1 addition & 0 deletions doc/git-add-deleted/alias.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git add "$(git ls-files --deleted | sort -u)"
29 changes: 29 additions & 0 deletions doc/git-add-deleted/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Add deleted files.

Example:

```shell
git add-deleted
```

Compare:

* [git add-cached](../git-add-cached)
* [git add-deleted](../git-add-deleted) (this alias)
* [git add-others](../git-add-others)
* [git add-ignored](../git-add-ignored)
* [git add-killed](../git-add-killed)
* [git add-modified](../git-add-modified)
* [git add-stage](../git-add-stage)
* [git add-unmerged](../git-add-unmerged)

Compare corresponding aliases for `edit-*`:

* [git edit-cached](../git-edit-cached)
* [git edit-deleted](../git-edit-deleted)
* [git edit-others](../git-edit-others)
* [git edit-ignored](../git-edit-ignored)
* [git edit-killed](../git-edit-killed)
* [git edit-modified](../git-edit-modified)
* [git edit-stage](../git-edit-stage)
* [git edit-unmerged](../git-edit-unmerged)
1 change: 1 addition & 0 deletions doc/git-add-ignored/alias.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git add "$(git ls-files --ignored | sort -u)"
29 changes: 29 additions & 0 deletions doc/git-add-ignored/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Add ignored files.

Example:

```shell
git add-ignored
```

Compare aliases for `add-*`:

* [git add-cached](../git-add-cached)
* [git add-deleted](../git-add-deleted)
* [git add-others](../git-add-others)
* [git add-ignored](../git-add-ignored) (this alias)
* [git add-killed](../git-add-killed)
* [git add-modified](../git-add-modified)
* [git add-stage](../git-add-stage)
* [git add-unmerged](../git-add-unmerged)

Compare aliases for `edit-*`:

* [git edit-cached](../git-edit-cached)
* [git edit-deleted](../git-edit-deleted)
* [git edit-others](../git-edit-others)
* [git edit-ignored](../git-edit-ignored)
* [git edit-killed](../git-edit-killed)
* [git edit-modified](../git-edit-modified)
* [git edit-stage](../git-edit-stage)
* [git edit-unmerged](../git-edit-unmerged)
1 change: 1 addition & 0 deletions doc/git-add-killed/alias.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git add "$(git ls-files --killed | sort -u)"
29 changes: 29 additions & 0 deletions doc/git-add-killed/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Add killed files.

Example:

```shell
git add-killed
```

Compare:

* [git add-cached](../git-add-cached)
* [git add-deleted](../git-add-deleted)
* [git add-others](../git-add-others)
* [git add-ignored](../git-add-ignored)
* [git add-killed](../git-add-killed) (this alias)
* [git add-modified](../git-add-modified)
* [git add-stage](../git-add-stage)
* [git add-unmerged](../git-add-unmerged)

Compare corresponding aliases for `edit-*`:

* [git edit-cached](../git-edit-cached)
* [git edit-deleted](../git-edit-deleted)
* [git edit-others](../git-edit-others)
* [git edit-ignored](../git-edit-ignored)
* [git edit-killed](../git-edit-killed)
* [git edit-modified](../git-edit-modified)
* [git edit-stage](../git-edit-stage)
* [git edit-unmerged](../git-edit-unmerged)
1 change: 1 addition & 0 deletions doc/git-add-modified/alias.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git add "$(git ls-files --modified | sort -u)"
29 changes: 29 additions & 0 deletions doc/git-add-modified/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Add modified files.

Example:

```shell
git add-modified
```

Compare:

* [git add-cached](../git-add-cached)
* [git add-deleted](../git-add-deleted)
* [git add-others](../git-add-others)
* [git add-ignored](../git-add-ignored)
* [git add-killed](../git-add-killed)
* [git add-modified](../git-add-modified) (this alias)
* [git add-stage](../git-add-stage)
* [git add-unmerged](../git-add-unmerged)

Compare corresponding aliases for `edit-*`:

* [git edit-cached](../git-edit-cached)
* [git edit-deleted](../git-edit-deleted)
* [git edit-others](../git-edit-others)
* [git edit-ignored](../git-edit-ignored)
* [git edit-killed](../git-edit-killed)
* [git edit-modified](../git-edit-modified)
* [git edit-stage](../git-edit-stage)
* [git edit-unmerged](../git-edit-unmerged)
1 change: 1 addition & 0 deletions doc/git-add-others/alias.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git add "$(git ls-files --others | sort -u)"
29 changes: 29 additions & 0 deletions doc/git-add-others/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Add other files.

Example:

```shell
git add-others
```

Compare:

* [git add-cached](../git-add-cached)
* [git add-deleted](../git-add-deleted)
* [git add-others](../git-add-others) (this alias)
* [git add-ignored](../git-add-ignored)
* [git add-killed](../git-add-killed)
* [git add-modified](../git-add-modified)
* [git add-stage](../git-add-stage)
* [git add-unmerged](../git-add-unmerged)

Compare corresponding aliases for `edit-*`:

* [git edit-cached](../git-edit-cached)
* [git edit-deleted](../git-edit-deleted)
* [git edit-others](../git-edit-others)
* [git edit-ignored](../git-edit-ignored)
* [git edit-killed](../git-edit-killed)
* [git edit-modified](../git-edit-modified)
* [git edit-stage](../git-edit-stage)
* [git edit-unmerged](../git-edit-unmerged)
1 change: 1 addition & 0 deletions doc/git-add-stage/alias.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git add "$(git ls-files --stage | cut -f2 | sort -u)"
29 changes: 29 additions & 0 deletions doc/git-add-stage/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Add stage files.

Example:

```shell
git add-stage
```

Compare:

* [git add-cached](../git-add-cached)
* [git add-deleted](../git-add-deleted)
* [git add-others](../git-add-others)
* [git add-ignored](../git-add-ignored)
* [git add-killed](../git-add-killed)
* [git add-modified](../git-add-modified)
* [git add-stage](../git-add-stage) (this alias)
* [git add-unmerged](../git-add-unmerged)

Compare corresponding aliases for `edit-*`:

* [git edit-cached](../git-edit-cached)
* [git edit-deleted](../git-edit-deleted)
* [git edit-others](../git-edit-others)
* [git edit-ignored](../git-edit-ignored)
* [git edit-killed](../git-edit-killed)
* [git edit-modified](../git-edit-modified)
* [git edit-stage](../git-edit-stage)
* [git edit-unmerged](../git-edit-unmerged)
1 change: 1 addition & 0 deletions doc/git-add-unmerged/alias.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git add "$(git ls-files --unmerged | cut -f2 | sort -u)"
29 changes: 29 additions & 0 deletions doc/git-add-unmerged/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Add unmerged files.

Example:

```shell
git add-unmerged
```

Compare:

* [git add-cached](../git-add-cached)
* [git add-deleted](../git-add-deleted)
* [git add-others](../git-add-others)
* [git add-ignored](../git-add-ignored)
* [git add-killed](../git-add-killed)
* [git add-modified](../git-add-modified)
* [git add-stage](../git-add-stage) (this alias)
* [git add-unmerged](../git-add-unmerged)

Compare corresponding aliases for `edit-*`:

* [git edit-cached](../git-edit-cached)
* [git edit-deleted](../git-edit-deleted)
* [git edit-others](../git-edit-others)
* [git edit-ignored](../git-edit-ignored)
* [git edit-killed](../git-edit-killed)
* [git edit-modified](../git-edit-modified)
* [git edit-stage](../git-edit-stage)
* [git edit-unmerged](../git-edit-unmerged)
42 changes: 42 additions & 0 deletions doc/git-add/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# git add

## Aliases to add files


### Shortcuts

* [git a](../git-a) = add
* [git aa](../git-aa) = add --all
* [git ap](../git-ap) = add --patch
* [git au](../git-au) = add --update


### Add all paths of the given type

Git alias:

```git
add-cached = !"f() { git ls-files --cached | sort -u ; }; git add `f`"
add-deleted = !"f() { git ls-files --deleted | sort -u ; }; git add `f`"
add-others = !"f() { git ls-files --others | sort -u ; }; git add `f`"
add-ignored = !"f() { git ls-files --ignored | sort -u ; }; git add `f`"
add-killed = !"f() { git ls-files --killed | sort -u ; }; git add `f`"
add-modified = !"f() { git ls-files --modified | sort -u ; }; git add `f`"
add-stage = !"f() { git ls-files --stage | cut -f2 | sort -u ; }; git add `f`"
add-unmerged = !"f() { git ls-files --unmerged | cut -f2 | sort -u ; }; git add `f`"
```

Example:

```shell
git add-cached
git add-deleted
git add-others
git add-ignored
git add-killed
git add-modified
git add-stage
git add-unmerged
```

These aliases intentionally match the aliases [git edit-*](../git-edit).
1 change: 1 addition & 0 deletions doc/git-alias/alias.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f(){ echo "Git Alias is project that has a collection of git alias commands."; echo "The purpose is to help make git easier, faster, and more capable."; echo "Free open source repository <https://github.com/gitalias/gitalias>."; echo ""; echo "To see your existing git aliases:"; echo " git aliases"; echo ""; echo "To see your existing git aliases by using git directly:"; echo " git config --get-regexp ^alias\."; };f
7 changes: 7 additions & 0 deletions doc/git-alias/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Git alias help.

Example:

```shell
git alias
```
1 change: 1 addition & 0 deletions doc/git-aliases/alias.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git config --get-regexp '^alias\.' | cut -c 7- | sed 's/ / = /'
21 changes: 21 additions & 0 deletions doc/git-aliases/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
List Git aliases.

Example:

```shell
git aliases
```

This alias is because friendly wording is easier to remember.

Our friendly wording for plurals:

* [git aliases](../git-aliases)

* [git branches](../git-branches)

* [git stashes](../git-stashes)

* [git tags](../git-tags)

Thanks to <http://gggritso.com/human-git-aliases>.
1 change: 1 addition & 0 deletions doc/git-ap/alias.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add --patch
9 changes: 9 additions & 0 deletions doc/git-ap/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Short for "git add --patch" (add by patch).

Example:

```shell
git ap
```

Show each change, and ask if we want to stage it.
2 changes: 2 additions & 0 deletions doc/git-ap/git-ap.gitconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[alias]
ap = "add --patch"
1 change: 1 addition & 0 deletions doc/git-archive/alias.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f() { top="$(rev-parse --show-toplevel)"; cd "$top" || exit 1 ; tar cvf "$top.tar" "$top" ; }; f
10 changes: 10 additions & 0 deletions doc/git-archive/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Create an archive file of everything in the repo.

Example:

```shell
git archive
```

This archive can be useful for backups, disaster recovery,
legal auditing, or sending the repo as a file to someone.
Loading