Romain Jouin
Romain Jouin

Reputation: 4848

Git checkout ... doesn't checkout files

I am trying to find a compile-time error (see meteor compilation - error output doesn't show where is the error? ) by removing whole directory of my meteor app.

So I tried something like deleting the (client) and the (server) directory, to have an idea of where the mistake is :

$meteor
=> compile time mistake
$rm -rf ./client/*
$meteor
=> compile time mistake
$rm -rf ./server/*
$meteor
=> compile time mistake
$rm -rf ./api/*
$meteor
=> compile time mistake

Once I found that the misake was on api I tried to chekout again my last commit, but the files don't come back !

$ git branch
  erreur
* extra_erreur
  master
$ git checkout extra_erreur
D   client/cb.html
D   client/cb.js
D   client/choix_page.html
D   client/choix_page.js
D   client/hello.html
D   client/hello.js
D   client/home.html
D   client/home.js
D   client/ligne_produit.html
D   client/ligne_produit.js
D   client/main.css
D   client/main.html
D   client/main.js
D   client/menu.html
D   client/menu.js
D   client/navbar.html
D   client/navbar.js
D   client/restaurants.html
D   client/restaurants.js
D   client/subscribe.html
D   client/subscribe.js
D   client/templates.html
Already on 'extra_erreur'
$ cd client/
$ ls
$ 

I have to come back to (master) and then to (extra-erreur) to have them back :-/

$ git checkout master
D   client/choix_page.html
D   client/choix_page.js
D   client/hello.html
D   client/hello.js
D   client/home.html
D   client/home.js
D   client/main.css
D   client/main.html
D   client/templates.html
Switched to branch 'master'
Your branch is ahead of 'dorj/master' by 3 commits.
  (use "git push" to publish your local commits)
$ git checkout extra_erreur
D   client/choix_page.html
D   client/choix_page.js
D   client/hello.html
D   client/hello.js
D   client/home.html
D   client/home.js
D   client/main.css
D   client/main.html
D   client/templates.html
Switched to branch 'extra_erreur'
$ ls
client      common      imports     node_modules    package.json    server
$ cd client/
$ ls
cb.html         ligne_produit.html  main.js         menu.js         navbar.js       restaurants.js      subscribe.js
cb.js           ligne_produit.js    menu.html       navbar.html     restaurants.html    subscribe.html

I don't get it :-( What are the 'D' meaning ?

Upvotes: 0

Views: 157

Answers (1)

Mort
Mort

Reputation: 3549

git checkout -- client server api for just those directories

or

git checkout -- . for everything

Git can be very confusing, and the way its commands work and take parameters can be inconsistent. Having said that, I'm sure between the help pages and googling, I'm sure you could have come up with this yourself.

Upvotes: 1

Related Questions