Skip to content

Instantly share code, notes, and snippets.

@VirtualMaestro
Last active August 5, 2021 07:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VirtualMaestro/6c204b658322906bdf84471f635c1748 to your computer and use it in GitHub Desktop.
Save VirtualMaestro/6c204b658322906bdf84471f635c1748 to your computer and use it in GitHub Desktop.
[winUpdater]
recentlySeenVersion = 2.24.0.windows.2
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[push]
default = simple
[core]
autocrlf = input
[credential]
helper = wincred
[user]
name = YOUR_NAME
email = YOUR_EMAIL
[alias]
st = "!f() { git status;}; f"
# Show complex branch status - local, remote, upstream: 'git brst'
brst = "!f() { git branch -vv; git rst;}; f"
pu = "!f() { git push origin HEAD;}; f"
upd = "!f() { git pull -r; git submodule update;}; f"
upds = "!f() { git stash save; git pull -r; git stash pop; git status;}; f"
track = "!f() { git push -u origin HEAD;}; f"
co = "!f() { git checkout $1;}; f"
cou = "!f() { git checkout $1; git pull; git subur;}; f"
# Checkout new branch and set track.
con = "!f() { git checkout -b $1; git track;}; f"
# Remove branch local and remote: $1 - branch name: 'git rbr develop'
rbr = "!f() { git push origin :$1; git branch -D $1;}; f"
br = "!f() { git branch;}; f"
# Clean remote from redundant branches: 'git rclean'
rclean = "!f() { git remote prune origin;}; f"
# Create tag. $1 - tag name: 'git ctag v0.1'
ctag = "!f() { git tag -a $1 -m "$1";}; f"
# Push tags to remote. 'git ptag'
ptag = "!f() { git push --tags;}; f"
# Create and push tag. $1 - tag name: 'git cptag v0.1'
cptag = "!f() { git ctag $1; git ptag;}; f"
# Remote tag and push changes to a remote. $1 - tag name: 'git rtag v0.1'
rtag = "!f() { git fetch --prune origin '+refs/tags/*:refs/tags/*'; git push origin --delete $1; git fetch --prune origin '+refs/tags/*:refs/tags/*';}; f"
fet = "!f() { git fetch origin $1;}; f"
fetd = "!f() { git fetch origin develop:develop;}; f"
fets = "!f() { git fetch origin staging:staging;}; f"
fetm = "!f() { git fetch origin master:master;}; f"
# Setup new link for upstream. $1 - url to repo: 'git addup git@github.com:xxx/myproject.git'
addup = "!f() { git remote add upstream $1; git rst;}; f"
# Change an upstream to the new link. $1 - url to repo: 'git chup git@github.com:xxx/myproject.git'
chup = "!f() { git remote set-url upstream $1; git rst;}; f"
# Change remote origin: $1 - new origin url:
chorig = "!f() { git remote set-url origin $1; git orst; git rst;}; f"
# Update a branch from upstream. $1 - branch name: 'git updfork master'
updfork = "!f() { git fetup; git checkout $1; git merge upstream/$1;}; f"
# Show status what is origin and upstream setup. 'git rst'
rst = "!f() { git remote show origin; git remote show upstream;}; f"
# Show log of upstream branch. $1 - branch name: 'git logup master'
logup = "!f() { git log upstream/$1;}; f"
# Fetch upstream: 'git fetup'
fetup = "!f() { git fetch upstream;}; f"
subst = "!f() { git submodule status --recursive;}; f"
subupinit = "!f() { git submodule update --init --recursive;}; f"
# Add submodule: 'git suba git@github.com:Leopotam/ecs.git leoecs'
suba = "!f() { git submodule add $1 $2; git subupinit;}; f"
subu = "!f() { git submodule sync; git submodule update;}; f"
# Update all submodules recursive
subur = "!f() { git submodule sync; git submodule update --remote --merge --recursive --force;}; f"
suburc = "!f() { git submodule sync; git submodule update --remote --merge --recursive --force; git commit -m "Submodules updated";}; f"
# Remove submodule with a given name: 'git subrm leoecs'
subrm = "!f() { git submodule deinit -f $1; git rm -f $1; git commit -m 'Removed submodule'; rm -rf .git/modules/$1;}; f"
subrea = "!f() { git subrm $2; git suba $1 $2;}; f"
submaster = "!f() { git submodule foreach --recursive 'git cou master';}; f"
subdevelop = "!f() { git submodule foreach --recursive 'git cou develop';}; f"
# Update all submodules (better to use this version, more complex and includes 'subur')
subupd = "!f() { git submodule foreach --recursive 'git pull; git subur;';}; f"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment