re: How to write Bash one-liners for cloning and managing GitHub and GitLab repositories VIEW POST


Nifty aliases to simplify daily Git tasks, Victoria! Adding a few more I made that might help:

# Setting upstream on creating a new branch in any GIT repo
function git-new-upstream () {
git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)

# Check if branch on local exists on remote, provide branch name as $1
function git-remote-check () {
git ls-remote --heads origin $1

Note: These should be added in .bashrc & then reloaded either via by source .bashrc or opening a new terminal session

code of conduct - report abuse