Skip to main content
Photo by Roman Synkevych via Unsplash

Git push.default setup

Pushing a new branch to a repository’s remote often requires two attempts by the scatterbrained developer:

1❯ git push origin
2fatal: The current branch newbranchname has no upstream branch.
3To push the current branch and set the remote as upstream, use
5    git push --set-upstream origin newbranchname

While it’s easy to copy and paste that hint, there is a way to tell Git to create that missing branch the first time we attempt to push.

With the push.autoSetupRemote configuration option in Git, it automatically sets up the remote branch when pushing for the first time, eliminating the need to set the upstream branch or encountering errors due to missing upstream references.

Enabling push.autoSetupRemote is simple. Just use the following command:

1git config --global --add --bool push.autoSetupRemote true

This command sets the push.autoSetupRemote option to true globally, ensuring that Git automatically sets up the remote branch whenever you push for the first time in any repository on your system.

By enabling push.autoSetupRemote, you can avoid the hassle of thinking when setting up remote branches manually.

Recent Posts

Photo by Mohammad Rahmani via Unsplash

Automatically load workspace when starting VSCode

Workspaces are a great feature in VSCode. But they have their issues. For instance starting VSCode in a folder will not automatically load the workspace file. This can be annoying if you have a workspace file in the folder and you want to open it directly.

Photo by Roman Synkevych via Unsplash

How to delete all files ignored by Git

The .gitignore file in a Git repository serves as a configuration file that specifies files and directories that Git should — as the name implies — ignore. When Git encounters a file or directory listed in .gitignore, it automatically excludes them from being tracked, preventing them from showing up in commands like git status and git add.

Setting up highlighted notes in GitHub Markdown

Highlighting blockquotes in GitHub Markdown format

GitHub recently introduced an innovative feature for Markdown documents that allows users to highlight “Note”, “Warning”, and other notification blocks more effectively. An enhancement useful for developers who want to draw attention to important information in their documentation or discussions.

Twitter as imagined by DALL-E (disclaimer: the prompt might have been passive agressive)

Erasing ~2 decades of Twitter

A while back (about 15 months ago), I stopped using Twitter. At first, I thought I might delete my account, but then I realized that somewhere along the lines, Twitter has begun to enforce a “you have to have an account to watch this content” rule.

Photo by Roman Synkevych via Unsplash

Bash Function to Remove Github Ghost Notifications

Every now and then my inbox in Github shows x total unread updates without having actual updates. When I click on it, there are no unread notifications. This is a known issue and it’s been around for a while. The notifications are called “ghost notifications” and they are not visible in the UI.

Photo by Roman Synkevych via Unsplash

Git stashes for ADHDers

If you are like me you probably typed more than once git stash and meant git stash list while working on many different things at the same time. If not, then feel free to go somewhere else and don’t waste your time here :]

Back to top
Back Forward