0

I wanted to change my gitignore to ignore some of my files and I did as this Question said.Now when I was through with these steps I saw a long list of deleted files. At the moment, I committed the code but I am afraid that this will delete all the files.I want to completely revert the commit before I push the code.

So my questions are:

  1. If I push the code with the lasted change that I made. Will it delete the files in the main repo.(Intrestingly files are there in my machine.they are not deleted. Am I just being a chicken!!)
  2. How do I revert the latest commit that I just did, not just edit that log and stuffs but ignore the commit totally.
Community
  • 1
  • 1

2 Answers2

0

To revert: find the commit number you want to revert to with git log, then do git checkout yourcommitnumber.

Also, a good source of information: http://git-scm.com/book/ch6-4.html

joewright
  • 325
  • 3
  • 7
0
  1. If your gitk show you that your files deleted that means that origin files will be removed too.
  2. Use git rebase HEAD~1, where 1 - is number of commits you want to change. This will open your editor, where you can pick/squash/edit commits. Pick all needed commits and save file (if want to remove commit just remove/comment line)

    #pick f7f3f6d commit that I want to remove
    pick 310154e updated README formatting and added blame
    pick a5f4a0d added cat-file
    
Rustam Safin
  • 812
  • 7
  • 15