profile

Néstor's Blog

Git Push Current Branch Shortcut

git cli productivity

Use HEAD to reference the current branch:

# Do this
git push -u origin HEAD

First Push Workflow

# Create and switch to new branch
git checkout -b feature/new-feature

# Make changes and commit
git add .
git commit -m "Add new feature"

# Push using HEAD
git push -u origin HEAD

One-Time Setup

After the first push with -u, subsequent pushes are even simpler:

git push