DEV Community

Discussion on: How to write Bash one-liners for cloning and managing GitHub and GitLab repositories

Collapse
 
vinayhegde1990 profile image
Vinay Hegde • Edited

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
}
Enter fullscreen mode Exit fullscreen mode

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