My issue is I have changed a file eg: README, added a new line \'this for my testing line\' and saved the file, then I issued the following commands
gi
You can tell Git what to do with your index (set of files that will become the next commit) and working directory when performing git reset by using one of the parameters:
--soft
: Only commits will be reseted, while Index and the working directory are not altered.
--mixed
: This will reset the index to match the HEAD, while working directory will not be touched. All the changes will stay in the working directory and appear as modified.
--hard
: It resets everything (commits, index, working directory) to match the HEAD.
In your case, I would use git reset --soft
to keep your modified changes in Index and working directory. Be sure to check this out for a more detailed explanation.