Skip to content

Instantly share code, notes, and snippets.

@D1360-64RC14
Last active March 25, 2025 14:09
Show Gist options
  • Save D1360-64RC14/80691401a0331a840c0276f05a6a66dd to your computer and use it in GitHub Desktop.
Save D1360-64RC14/80691401a0331a840c0276f05a6a66dd to your computer and use it in GitHub Desktop.
Git commands to automate repetitive tasks. Store then in a directory accessible by PATH and do `git <command>`, like `git spull`.
#!/bin/bash
# Push setting current branch as default upstream
git push -u origin $(git branch --show-current)
#!/bin/bash
# Stash -> Pull -> Pop
git stash
git pull
git stash pop
#!/bin/bash
# Stash -> Pull -> Push -> Pop
git stash
git pull
git stash pop
git push
#!/bin/bash
# Stash -> Push -> Pop
git stash
git push
git stash pop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment