git Force Push

Date:

[ad_1]

Rebasing is a frequent task for anyone using git. We sometimes use rebasing to branch our code from the last changes or even just to drop commits from a branch.

Oftentimes when trying to push after a rebase, you’ll see something like the following:

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.

Commonly developers will use the --force or -f flags during a push to force pushing code changes:

git push origin my-branch --force
# or
git push origin my-branch -f

I was recently surprised to find out that you could also prefix the branch name with + to force a push:

git push origin +my-branch

The + syntax is interesting but doesn’t seem intuitive so it’s not a practice I’d use, but that doesn’t mean you shouldn’t!

  • Convert XML to JSON with JavaScript
  • fetch API

    One of the worst kept secrets about AJAX on the web is that the underlying API for it, XMLHttpRequest, wasn’t really made for what we’ve been using it for.  We’ve done well to create elegant APIs around XHR but we know we can do better.  Our effort to…

  • MooTools 1.3 Browser Object

    MooTools 1.3 was just released and one of the big additions is the Browser object.  The Browser object is very helpful in that not only do you get information about browser type and browser versions, you can gain information about the user’s OS, browser plugins, and…

  • Create a Sheen Logo Effect with CSS

[ad_2]
Source link

Share post:

Subscribe

spot_imgspot_img

Popular

More like this
Related

Samsung Galaxy Tab S9 and Tab S9 Ultra appear on Geekbench

Samsung’s Galaxy Tab S9 series is expected to...

Life Evolves. Can Attempts to Create ‘Artificial Life’ Evolve, Too?

What is life? Like most great questions, this...

Former BitMex CEO Arthur Hayes Calls His Maelstrom Capital a ‘Very Patient’ Fund

Hayes, the former CEO of crypto exchange BitMex,...

Ponzi Schemes, Property Fraud, and How to NOT Fall for a Real Estate Scam

Real estate scams and Ponzi schemes have been...