gelzinn avatar
Back

git push current branch

when working with git, pushing your changes to a remote repository is a frequent task

instead of manually typing the branch name every time, you can use a simple command to push the current branch dynamically

git push origin $(git branch --show-current)

this command extracts the active branch name using git branch --show-current and pushes it to the origin remote

is particularly useful when you have multiple branches and want to push changes to a specific branch without having to remember its name. before running the command, make sure to replace origin with the name of your remote repository if it's different