RajKon
RajKon

Reputation: 470

git pull, git reset HEAD <new_files_from_pull> , git push. Why are those new_files_from_pull in pull request?

  1. I did a git pull and I got new files after that.

  2. I saw those new files in "Changes to be committed:" list when I did a git status. So I did git reset HEAD <new_file_from_pull> for all new files that I got. I ensured with git status that I have only my old files are in "Changes to be committed:" list.

  3. I did a git push origin <my_branch> and now both the new files which were not under that "Changes to be committed:" list and my old files which were under "Changes to be committed:" list got pushed. Why is that and how can I recover from it? I at least want to know if this is the correct way of doing it.

Upvotes: 0

Views: 177

Answers (1)

RajKon
RajKon

Reputation: 470

As suggested in comments, lesson learnt is to make sure for any command you execute there is a message and you read it. I observed that git commit -m <your message> will not give complete details on all the files that were/are going to be committed. So, first do git commit then you will see the actual files that are going to be committed. Read and make sure you have exactly the files that you want to commit, no less, no more. Then you can add comments and do wq as in vi editor. If you don't want to commit then simply do :q as in vi editor to cancel you commit process.

Upvotes: 1

Related Questions