Skip to content

Commit ed6544f

Browse files
committed
move separate repo into this one
1 parent 0106dc3 commit ed6544f

3 files changed

Lines changed: 79 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Git's "alias" feature provides a way for you to create shortcuts for other Git commands, which can save you a lot of time in the long run. If you want to learn more, [I wrote a bit about it here](https://grantwinney.com/what-is-a-git-alias-and-how-do-i-use-it/).
2+
3+
The `*.gitconfig` files in this repo are a collection of some useful aliases I created, some for long git commands or chains of commands, and others for common typos.
4+
5+
If you'd like to use them, you don't have to copy/paste anything. Instead, clone the repository and reference it from within your existing `.gitconfig` file, which has the added benefit of leaving your existing aliases and other settings untouched. Add the following section to your `.gitconfig` file, where `/your/path` is wherever you cloned the repo to.
6+
7+
```
8+
[include]
9+
path = "/your/path/git-alias-template/alias-shortcuts.gitconfig"
10+
path = "/your/path/git-alias-template/alias-typos.gitconfig"
11+
# etc...
12+
```
13+
14+
The `include` section imports settings from other files and merges their functionality without affecting the original config file.
15+
16+
You can read more about Git aliases here:
17+
18+
* [GitHowTo: Aliases](https://githowto.com/aliases)
19+
* [Pro Git: 2.7 Git Basics – Git Aliases](https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases)
20+
21+
Do you have any especially useful aliases of your own that you couldn't live without? If you want to share them, feel free to [create a pull request](https://help.github.com/articles/creating-a-pull-request/) and I'll check them out.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[alias]
2+
co = checkout
3+
cob = checkout -b
4+
ci = commit -m
5+
ec = config --global --edit
6+
st = status
7+
br = branch
8+
df = diff
9+
re = checkout .
10+
pop = stash pop
11+
rclone = clone --recursive
12+
13+
# recursively pull repo and its submodule (if any)
14+
rpull = !git pull && git submodule update --init --recursive
15+
16+
# list commits in short form, with colors and branch/tag annotations
17+
hist = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cgreen\\ [%cn]" --decorate --date=short
18+
hsit = !git hist
19+
20+
# similar to hist but includes a list of files changed in commit
21+
histf = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cgreen\\ [%cn]" --decorate --numstat
22+
hsitf = !git histf
23+
24+
# graph view of a project's commit history
25+
histg = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
26+
hsitg = !git histg
27+
28+
# add and commit changes, with and without a message
29+
ac = !git add . && git commit -m \"$1\" && :
30+
acnc = !git add . && git commit --allow-empty-message -m \"\"
31+
32+
# add and commit AND PUSH changes, with and without a message
33+
shove = !git add . && git commit -m \"$1\" && git push origin && :
34+
shovenc = !git add . && git commit --allow-empty-message -m \"\" && git push origin
35+
36+
# display your currently defined aliases
37+
aliases = !git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /'
38+
39+
# pass in the name or email address of someone involved with the project
40+
whois = "!sh -c 'git log -i -1 --pretty=\"format:%an <%ae>\n\" --author=\"$1\"' -"
41+
42+
# open the url for the current repo in the browser
43+
browse = "!open `git remote -v | grep fetch | awk '{print $2}' | sed 's=git@=https://=' | sed 's=com:=com/='`"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[alias]
2+
upsh = push
3+
psuh = push
4+
puhs = push
5+
pushh = push
6+
pll = pull
7+
pul = pull
8+
pulll = pull
9+
puill = pull
10+
commti = commit
11+
comtmi = commit
12+
cmmit = commit
13+
comit = commit
14+
committ = commit
15+
stauts = status

0 commit comments

Comments
 (0)