|
| 1 | +# ---------------- git worflows ---------------- # |
| 2 | + |
| 3 | +# Keep your GitHub forked repo in sync with the original repository with master as the primary branch |
| 4 | +function fetchremotems() { |
| 5 | + git fetch upstream && |
| 6 | + git merge upstream/master && |
| 7 | + git push origin master |
| 8 | +} |
| 9 | + |
| 10 | +# Keep your GitHub forked repo in sync with the original repository with main as the primary branch |
| 11 | +function fetchremotemn() { |
| 12 | + git fetch upstream && |
| 13 | + git merge upstream/main && |
| 14 | + git push origin main |
| 15 | +} |
| 16 | + |
| 17 | +# create new branch and checkout to it |
| 18 | +function gcb() { |
| 19 | + git checkout -b "${1}" |
| 20 | +} |
| 21 | + |
| 22 | +# checkout to a branch |
| 23 | +function gc() { |
| 24 | + git checkout "${1}" |
| 25 | +} |
| 26 | + |
| 27 | +# push changes to another branch |
| 28 | +function gbp() { |
| 29 | + git push origin "${1}" |
| 30 | +} |
| 31 | + |
| 32 | +# add, commit, push changes to github |
| 33 | +function gacp() { |
| 34 | + git add . && |
| 35 | + git commit -m "${1}" && |
| 36 | + git push |
| 37 | +} |
| 38 | + |
| 39 | +# aliases |
| 40 | +alias gi='git init' |
| 41 | +alias gs='git status' |
| 42 | +alias gaa='git add .' |
| 43 | +alias gc='git commit -m ' |
| 44 | +alias gp='git push' |
| 45 | +alias gpm='git push origin master' |
0 commit comments