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: -

To github.com:Foobar/documentation.git

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

error: failed to push some refs to 'github.com:Foobar/documentation.git'

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:

TIL - read-only variables in Linux

 A co-worker was seeing an exception: -  line 8: TMOUT: readonly variable when trying to SCP a file from a remote Linux box. I did some digg...