Reputation: 181
I cannot figure these out by myself (these are very easy to do with svn/rabbitvcs in Linux)
Also, when i do a pull, i get this error:
n $ git pull
error: Your local changes to the following files would be overwritten by merge:
Application/powerbar.cpp
Please, commit your changes or stash them before you can merge.
Aborting
But when i do a git diff
for the file it does not display anything.
Edit: Turns out that the file is a local file (powerbar.cpp), why does git want to overwrite my local file?
Edit: When i do "git checkout myfile.cpp" the following is displayed: error: path 'myfile.cpp' is unmerged
When i do "git reset myfile.cpp' then what exactly happens? It does NOT revert my local changes.
Upvotes: 1
Views: 5133
Reputation: 181
Okay, figured out question no 2 out as well, therefore posting it as answer.
The source of my confusion lies in the inconsistent command syntax of git (explained by this great article: http://stevebennett.me/2012/02/24/10-things-i-hate-about-git/).
To reset one file in your working directory to its committed state: git checkout file.txt
To reset every file in your working directory to its committed state: git reset --hard
And a final comment if i may: It seems that git has a long way to go to reach the level on consistency, usability and simplicity of svn.
Upvotes: 1
Reputation: 368
First, you should use git status
to see changes in your local directory. It will show you what you haven't commited. If you have untracked files - that is also a change from git point of view.
Second, if you want to compare your local commits to remote server use
git diff origin/{your_branch}
Upvotes: 1