Friday 28 January 2022

Git is well-named - again

 I was trying to push a newly created branch to a GitHub repository earlier, and kept seeing: -


 ! [rejected]        snafu-branch -> snafu-branch (non-fast-forward)

error: failed to push some refs to ''

hint: Updates were rejected because the tip of your current branch is behind

hint: its remote counterpart. Integrate the remote changes (e.g.

hint: 'git pull ...') before pushing again.

hint: See the 'Note about fast-forwards' in 'git push --help' for details.

After much tinkering and fiddling and cursing, I realised the problem.

I was trying to push a new branch to the GH project, without deleting a previously created branch OF THE SAME NAME.

I'd done some work last evening, and opened a PR - for various boring reasons, the PR didn't play nice, so I decided to close BUT forgot to delete the branch.

So, when I started again on my local machine, re-cloning the repo, rebasing on the main branch, creating my new branch, making the requisite changes etc. ....

Yes, I was trying to push a new branch of the same name over an existing branch

Once I deleted the branch in the repo ( it's my branch, I can do what I want ), all was good.

No comments:

Visual Studio Code - Wow 🙀

Why did I not know that I can merely hit [cmd] [p]  to bring up a search box allowing me to search my project e.g. a repo cloned from GitHub...