0

I just started learning git a few days ago and I started by setting up an example repo.

After performing a successful checkout using git checkout -f, when I run "git status" in the local repo, it comes back telling me all files have been modified.

I do not believe this is normal behavior and from my research, maybe it has something to do with line endings? I am running git on Windows 10 if that helps.

ilikemypizza
  • 362
  • 2
  • 13
  • Are you using the `-f` (aka _force_) option intentionally? Why? Do you use remote repos, so the interchange with another system can affect line endings? – Melebius May 12 '16 at 13:35
  • I used `-f` from a guide I had been following. The repo is located on a network drive that I have mapped. i.e. Z:/path/to/repo and i checked out to C:/users/username/Desktop/repo – ilikemypizza May 12 '16 at 13:38

1 Answers1

0

You should do the git status before and after anything else and have a look what state your working dir is currently in.

The checkout with the force option is most of the time not what you want. Therefore I have also to ask: Why are you using -f ?

I guess you want to switch branches but have uncommitted work or a conflict.

You CAN switch branches if you have uncommitted work and it won't conflict on the other branch. But most of the time and in the beginning I would recommend the use of the stash.

Read more here: Git Tools - Stashing

kitingChris
  • 658
  • 6
  • 15
  • Thanks. The use of `-f` was from a guide I had followed. My goal here is to use checkout with the intention of pushing my working tree to production. Hope this may clarify some things. – ilikemypizza May 12 '16 at 13:51
  • 1
    checkout is for switching branches. If you want to commit work you should do this on a dev branch and then merge it to production. – kitingChris May 12 '16 at 14:07
  • Thanks! I read up on this, created a production branch and this solved my problem. I will avoid using checkout unless switching branches. – ilikemypizza May 12 '16 at 14:39