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

Re: My first git success [not quite]

From
Junio C Hamano <junkio@cox.net>
Date
Jan 14, 2006, 20:31 UTC
Message-ID
<7vzmlyft61.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<86acdyu2dz.fsf@blue.stonehenge.com>
merlyn@stonehenge.com (Randal L. Schwartz) writes:
Show 5 quoted lines
> Well, I'm a developer and *I* also had that problem while working
> on my "ajax" branch.
>
> Maybe git-checkout should by default *warn* when it is leaving
> things in the tree that are indexed but not updated in the index...

What Linus already said. But you may find this on top of the current "master" branch useful.

Likes, dislikes?

-- >8 -- [PATCH] checkout: show dirty state upon switching branches.

This shows your working file state when you switch branches. As a side effect, "git checkout" without any branch name (i.e. stay on the current branch) becomes a more concise shorthand for the "git status" command.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff --git a/git-checkout.sh b/git-checkout.sh
index bd7f007..d99688f 100755
--- a/git-checkout.sh
+++ b/git-checkout.sh
@@ -164,6 +164,9 @@ else
 	esac
 	exit 0
     )
+    saved_err=$?
+    git diff-files --name-status
+    (exit $saved_err)
 fi
 
 # 
Previous: Randal L. SchwartzNext: Linus Torvalds
Message 10 of 15 in “My first git success”
  1. waltJan 13, 2006
  2. Linus TorvaldsJan 13, 2006
  3. Randal L. SchwartzJan 13, 2006
  4. Junio C HamanoJan 13, 2006
  5. Peter EriksenJan 13, 2006
  6. waltJan 14, 2006
  7. seanJan 14, 2006
  8. waltJan 14, 2006
  9. Randal L. SchwartzJan 14, 2006
  10. Junio C HamanoJan 14, 2006
  11. Linus TorvaldsJan 14, 2006
  12. waltJan 14, 2006
  13. Junio C HamanoJan 14, 2006
  14. Linus TorvaldsJan 14, 2006
  15. Junio C HamanoJan 15, 2006

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.