Home > OS >  Checking out from master and used -f with uncommitted changes
Checking out from master and used -f with uncommitted changes

Time:11-19

I am working for a company and we have a download counter on our website that is updated daily, so every time I pull from the remote repository there are changes that need to be committed, but I've been told to ignore this and that the Lead Developer will shove into a .gitignore folder at some point in the future (counter is a new addition to the website).

The problem is this:

I went to go checkout of the master branch and it wouldn't let me because I have uncommitted changes; being fairly new to git I used:

git checkout content-fs-04112021 -f 

(I assumed -f meant force)

Now when I checkout of the master branch again and use:

git status

It says my branch is up to date with origin/master and that there isn't anything to commit.

My intention wasn't to commit anything, but I just want to know what happened to my modified files.

Did I commit the changes on the master branch? If not, why don't the modified files show up?

CodePudding user response:

If you force checkout to another branch using,

git checkout branch_name -f

then you throw away your local changes and any untracked files. Basically in your scenario, you discarded your local changes and did not commit and push anything to master branch.

  • Related