Commit files disappeared

1

I was working on a branch with Eclipse. I finished the features and did the commit, then I moved to the master branch to push the server. But when I did this the commit disappeared, everything I had done disappeared. I went into the git repository and found only the COMMIT_EDITMSG file with the commit message I made. How do I recover the changes I had made?

    
asked by anonymous 25.08.2016 / 08:28

2 answers

1

When you commit the GIT "store" the state of your workspace, what I imagine you did was create a branch, add multiple files, work on what you needed, and commit right?

When you returned to the master branch git checkout master git reverts everything to the state of the branch you are entering, in the master case, that did not have the files that were added in the other branch.

I suggest you read the git documentation Branching in Git - Branch and Merge Basics

To have in the master branch what was done in the other branch you need to merge the two branches, with git merge , would be something like git merge meubranch .

When you use the merge, superficially speaking, git analyzes what has been changed, including files, removed, and "merges" with your branch, so that the two are in the same state.

One of the purposes of git is just that, you can navigate between the various states / commits, just to create a kind of life history of the files.

I do not know if I can be clear enough.

    
25.08.2016 / 13:23
1

Your changes must have stayed in the branch you were working on. To have these changes in the master, you should merge between the two.

    
25.08.2016 / 14:34