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

Re: checkout on an empty directory fails

From
Thomas Rast <trast@student.ethz.ch>
Date
Jan 5, 2012, 11:13 UTC
Message-ID
<87d3ayz9k3.fsf@thomas.inf.ethz.ch>
In-Reply-To
<4F0576D9.4030207@gmx.de>
René Doß <doss@gmx.de> writes:
> I have a clean derectory ang the git database. Now I want check out
> the master.
Ok, but why?  What problem were you really trying to solve?
Show 9 quoted lines
> red@linux-nrd1:~/iso/a> git checkout master
> D       SP601_RevC_annotated_master_ucf_8-28-09.ucf
> D       rtl/ether_speed.vhd
> D       rtl/ether_top.vhd
> D       rtl/ether_tx.vhd
> D       rtl/takt.vhd
> D       sim/makefile
> D       sim/tb_ether_top.vhd
> Already on 'master'

git-checkout considers this an uncommitted change compared to the current branch (HEAD). It actually ensures that you do not lose such changes.

To get your files back, you can use the file-argument form of checkout
  git checkout -- .
or the "really give me back the HEAD state, period" form of git-reset
  git reset --hard

Both of those *will* destroy uncommitted changes with no recourse or backup, so be careful.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Previous: Ramkumar Ramachandra
Message 7 of 7 in “checkout on an empty directory fails”
  1. René DoßJan 5, 2012
  2. Nguyen Thai Ngoc DuyJan 5, 2012
  3. René DoßJan 5, 2012
  4. Holger HellmuthJan 5, 2012
  5. Dirk SüsserottJan 5, 2012
  6. Ramkumar RamachandraJan 5, 2012
  7. Thomas RastJan 5, 2012

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.