git Force Push
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!
CSS animations are right up there with sliced bread. CSS animations are efficient because they can be hardware accelerated, they require no JavaScript overhead, and they are composed of very little CSS code. Quite often we add CSS transforms to elements via CSS during...
With CSS border-radius, I showed you how CSS can bridge the gap between design and development by adding rounded corners to elements. CSS gradients are another step in that direction. Now that CSS gradients are supported in Internet Explorer 8+, Firefox, Safari, and Chrome...
My team mate Edna Piranha is not only an awesome hacker; she's also a fantastic philosopher! Communication and online interactions is a subject that has kept her mind busy for a long time, and it has also resulted in a bunch of interesting experimental projects...
Backgrounds have become an integral part of creating a web 2.0-esque website since gradients have become all the rage. If you think gradient backgrounds are too cliche, maybe a fixed position background would work for you? It does provide a neat inherent effect by...
Thanks for the tip about the prefix, this is an interesting shortcut!
In most cases the
--force-with-lease
option seems safer in case there are some additional commits as well: https://git-scm.com/docs/git-push#Documentation/git-push.txt—no-force-with-lease