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

Re: Getting git to help my memory

From
Paul Ebermann <paul-ebermann@gmx.de>
Date
Jul 5, 2011, 22:08 UTC
Message-ID
<4E138B65.5000500@gmx.de>
In-Reply-To
<loom.20110705T232905-603@post.gmane.org>
Evan Driscoll schrieb:
Show 11 quoted lines
> I have a somewhat unusual question. I often forget to push after committing,
> and a few times this has come back to bite me. (One time I didn't even really
> realize for a couple months because I was working on other stuff, so
> unraveling the conflicts was "fun".)
> 
> Is there a way I can get git to print a "don't forget to push!" reminder
> after it commits?
> 
> The best way I can think of is to put a post-commit hook in there. I haven't
> tried it but I'd assume it would work, but would have to be on a
> per-repository basis instead of global.
Yes, I just tried this. Here is the output (from adding a file in the test branch):
---
$ git commit 
Don't forget to push!
[test ceabc34] adding test.txt.
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 test.txt
---
The output is a bit hidden here. Maybe coloring would help here a bit.

Is it really intentional that post-commit is called *before* the informational output here?

I have no idea on how to automatically add the hooks to all the repositories - AFAIK git clone will not copy these.

Paŭlo
Previous: Evan DriscollNext: Ben Walton
Message 2 of 4 in “Getting git to help my memory”
  1. Evan DriscollJul 5, 2011
  2. Paul EbermannJul 5, 2011
  3. Ben WaltonJul 5, 2011
  4. Matthieu MoyJul 6, 2011

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.