MaxouMask
MaxouMask

Reputation: 1037

git checkout <branchname> systematicaly modify files

This is driving me crazy and I can't find why it's doing this...

git clone [email protected]:/my/working/repo.git
--I don't do anything in the working copy--
git status
--no modification/no file to be commited--
git checkout another_branch
--I don't do anything in the working copy--
git status
modified: /some/file/that/I/touched.php
modified: /some/file/that/I/touched2.php
modified: /some/file/that/I/touched3.php

And when I do a git diff it shows only some line ending modifications. I see you coming... You're gonna tell me that I have to set autocrlf to false... Already tried that, and changes nothing...

If anyone has an idea on how to fix this i'd be more than pleased...

Thank you.

Upvotes: 1

Views: 143

Answers (1)

Sourabh
Sourabh

Reputation: 197

You should try:

git clone [email protected]:/my/working/repo.git
git branch another_branch
git checkout another_branch
git pull origin another_branch

I hope it should work for you.

Because if we do git checkout another_branch directly it will switch to the Remote branch not creating branch locally.

Second way is:

do git checkout -b another_branch

Upvotes: 1

Related Questions