Pocket Theories

Git

Updated: September 8, 2024


# Get the current branch name
git branch  # The one with the asterisk is current
git branch --show-current
git rev-parse --abbrev-ref HEAD  # For old versions which dont have "git branch"

# Merge from main to someBranch
git checkout someBranch
git merge main

# Merge from someBranch to main
git checkout main
git merge someBranch

# Set upstream branch for local branch
git push --set-upstream origin someBranch