I am a newbie in Git. I did a mistake and now need to undo the same mistake. I cloned from a remote repository and that brought down fileA and fileB in my working directory. I made a commit and in that commit, I modified fileA and fileB from what is on the server. (These changes shouldn't go to production).
I also pushed the commit to a remote branch of the origin server.
Now I need to do two things:
How do I do this? Any help will be highly appreciated.
If you need to undo the last commit and keep the changes then do reset
.
$ git checkout <your-branch>
$ git reset --soft HEAD~1 # undo last commits, and you've changes that you done.
now do change/fix
$ git commit -am 'new-message' # add & commit your changes
$ git push -f origin HEAD # force push to master
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.