Commit files are missing

Asked

Viewed 868 times

1

I was working on a branch with Eclipse. I finished the features and committed, then switched to the master branch to push to the server. But when I did, the commit was gone, everything I’d done was gone. I went to git Repository and found only the COMMIT_EDITMSG file with the commit message I made. How to recover the changes I had made?

  • You probably committed but didn’t push, check out the branch you were working on and check if the files came back, if they came back you can push or merge with the master branch.

2 answers

1

Your changes must have been in the branch that Voce was working on. To have these changes in master, you must merge the two.

1


GIT when you give the commit "stores" the state of your Workspace, what I imagine you did was create a branch, add several files, work on what you needed and commit right?

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

I suggest you read the git documentation Branch (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’s changed, files included, removed, and "merge" with your branch, so 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 don’t know if I could be clear enough.

  • I was able to retrieve the repositories history.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.