git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Adding --force-if-newer flag to git push

From
SSergey <sryze@protonmail.com>
Date
Oct 22, 2022, 16:58 UTC
Message-ID
<491oWe6HDMJXQK2Ru2VbzFrlUajNlVhnIErZZ1dxUaPpCElsgpASAEQFc2Zi1R4G53hAIMHopETEJn7E_TzeeC6uOzGBffQDRK2AWYPIxKQ=@protonmail.com>
Hello,
Would it be a good idea to add a new flag  --force-if-newer to the "git push" command, so that force-pushing would succeed only if the last local commit's date is newer than that on the remote branch?
Sometimes I find that a feature like this would be useful when I work on multiple different computers and I want to just push all local branches to the repo at once to sync it with whatever is the latest version. I know that using --force is kind of frowned upon in the Git community, so this is probably not the best idea because it would promote usage of this feature among the users. I just wanted to know your opinions and see if someone else would find it useul or it's just a dumb idea.
Thanks.
Next: Junio C Hamano
Message 1 of 3 in “Adding --force-if-newer flag to git push”
  1. SergeyOct 22, 2022
  2. Junio C HamanoOct 22, 2022
  3. Erik Cervin EdinOct 25, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.