Git checkout does not change local files / folders

3

I'm starting to get introduced to GIT. And I had a problem.

Apparently, the checkout was not changing the local files.

Let me explain better:

My flow is simple, clone, change code, commit, push / pull, branch, checkout and some merges.

So, I made a new Branch to sort out the project folder structure.

I removed some, moved others, created new folders, etc. I set everything up for the project to work.

When I did the git status, I received a giant list with folders / files deleted or created. I've been seeing an easier way to do git rm and add. So with git add --help, I decided that add - all was a good solution for me.

I did the commit and push, then left.

In the morning, my team took the branch where I changed the folder paths and started working. Later, when I arrived, I decided to pull to get the group changes.

I went from branch to branch, to see the changes (checkout branch-name).

I noticed that all of the branches had errors, and I started to search the why. Soon I came to the conclusion that when I checkout the branches, my new structure was still mixed with the old folder structure.

I tried to reset HEAD --hard, but it did not. I noticed that regardless of the commit you were in, the files were not changed.

The way was to make a new clone of the project. I imagine this was a nut solution, but after hours, it was the solution.

I would like to know what I did wrong, to make it happen.

Does anyone have any ideas? Is my concept of checkout wrong?

    
asked by anonymous 03.06.2014 / 22:54

1 answer

2

Cutia,

I think you have a mistake there in your procedure. I follow a procedure similar to yours and I miss something. Here are the steps I perform:

git pull
git checkout -b mytest

Here I work a lot, testo and I'm satisfied ... Then:

git checkout master
git merge --no-ff mytest

Those steps above is what I think you needed to do.

git branch -d mytest
git commit -m "Explicação do que fiz"
git push

From what I noticed you did not go back to your master and do the merge of the branch you created. What will matter to your team is the master (or whatever you name it).

Hugs,

    
11.06.2014 / 22:06