Skip to content

Instantly share code, notes, and snippets.

@disouzam
Last active June 12, 2024 00:48
Show Gist options
  • Save disouzam/03779f9c7163b890deb304f293b3e709 to your computer and use it in GitHub Desktop.
Save disouzam/03779f9c7163b890deb304f293b3e709 to your computer and use it in GitHub Desktop.
Useful git configs
[user]
name = Dickson Souza
email = 36424026+disouzam@users.noreply.github.com
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
excludesfile = ../.vscode/**
[checkout]
defaultremote = fork
[push]
defaultremote = fork
[alias]
all = add .
amend = commit --amend
ce = commit
id = log --pretty=format:%h -1
check = diff --check
ci = commit -m
co = checkout
cb = checkout --track
cluntd = clean --dry-run
cluntf = clean -q -f
cpp = cherry-pick
cpn = cherry-pick --no-commit
cpr = cherry-pick -x --edit
deltag = push --tags --delete
diffA = diff --cached --diff-filter=A -w --unified=0
diffD = diff --cached --diff-filter=D -w --unified=0
diffM = diff --cached --diff-filter=M -w --unified=0
diffStaged = diff --cached -w --unified=0
fe = fetch --prune --prune-tags --verbose
fe2 = fetch --prune --verbose
fl = log --format=oneline
lo = log --decorate --pretty=medium
lo2 = log --stat --pretty=medium
lo3 = log --stat -p --pretty=medium
logfile = log --pretty=medium -p
lol = log --graph --oneline --decorate
lolAll = log --graph --oneline --branches --all --decorate
nb = checkout -b
pl = pull
ps = push
pslease = push --force-with-lease
ssh = stash show -u
ssha = stash push --staged
sshl = stash list -p --stat --pretty=medium -n 1 -s --skip
sshp = stash show -u -p
st = status -uall
stage = add
stat = diff --cached --stat
summary = log --summary --pretty='1. %Cred**%h**%Creset %s%n%b'
tg = tag -l
tgref = show-ref --tags -s -d
track = push --set-upstream origin
unstage = reset HEAD --
up = !git co && git fe && git pl
[fetch]
prune = true
[log]
abbrevCommit = true
[format]
pretty = 1. %Cred**%h**%Creset %s
[push]
autoSetupRemote = true
@disouzam
Copy link
Author

List of useful git configs I use at work

@disouzam
Copy link
Author

disouzam commented Oct 8, 2023

Added another useful git alias:

track = push --set-upstream origin

@disouzam
Copy link
Author

Set auto setup of local branch:

git config --global push.autoSetupRemote true

@disouzam
Copy link
Author

Diff of the last change:

diff --git a/Useful-git-configs.txt b/Useful-git-configs.txt
index ca260b2..7972738 100644
--- a/Useful-git-configs.txt
+++ b/Useful-git-configs.txt
@@ -6 +5,0 @@
-	check = diff --check
@@ -8 +7 @@
-	co = checkout
+    co = checkout main
@@ -10,2 +8,0 @@
-    cluntd = clean --dry-run
-    cluntf = clean -q -f
@@ -14,2 +11 @@
-    cpr = cherry-pick -x --edit
-    deltag = push --tags --delete
+    cpr = cherry-pick -x
@@ -35,2 +31 @@
-	sshl = stash list -p --stat --pretty=medium -n 1 -s --skip
-    sshp = stash show -u -p
+    sshl = stash list -p -n 1 -s --skip

@disouzam
Copy link
Author

Added e-mail configuration for GitHub repos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment