Page 1 of 1

Newbie msysgit question

PostPosted: Thursday, 11th April 2013, 17:44
by cjo
I wanted to mess around with Crawl code, so I consulted the stickies and used msysgit via the following quickstart guide: posting.php?mode=post&f=22

I had no intention of submitting code at this point, I was just testing my own ability to make changes to the code in question. I edited some code, ran make, tested it, and then used the 'commit' command. However, I never used the 'push' command.

I thought I would be able to revert to the basic code with the "git checkout --filename" command. But when I ran it, I still had my edited code. So I tried deleting the file in question, confirming that it was deleted, then doing "git checkout --filename." Oddly, I still ended up with my edited code!

Why am I not reverting to the public code, and how can I do so?

Re: Newbie msysgit question

PostPosted: Thursday, 11th April 2013, 17:50
by mumra
  Code:
git reset --hard HEAD^


Here's some more information on the git reset command: https://www.kernel.org/pub/software/scm/git/docs/git-reset.html

Re: Newbie msysgit question

PostPosted: Thursday, 11th April 2013, 18:02
by cjo
mumra wrote:
  Code:
git reset --hard HEAD^


Here's some more information on the git reset command: https://www.kernel.org/pub/software/scm/git/docs/git-reset.html

Thanks, both for the command and the link!

Re: Newbie msysgit question

PostPosted: Thursday, 11th April 2013, 20:03
by Galefury
If you want to change things, it's best to create a new branch and make your changes there. That way you can easily switch back and forth without losing anything.

Re: Newbie msysgit question

PostPosted: Friday, 12th April 2013, 12:22
by cjo
Galefury wrote:If you want to change things, it's best to create a new branch and make your changes there. That way you can easily switch back and forth without losing anything.


I did keep my tinkering separate from my regular crawl install, but do you mean I should also make a separate branch each time I start a new set of edits?

(I'm pretty psyched, actually! I installed msysgit, got the code, used grep to find the files I wanted, added a new demonspawn-specific mutation, compiled, ran crawl, and used wiz mode to test my new mutation. My newbie self was very proud. :) )

Re: Newbie msysgit question

PostPosted: Friday, 12th April 2013, 12:44
by BlackSheep
Not necessarily for every edit, but maybe one for your own edits so that if you want to compile the latest trunk and play you just need to switch branches instead of discarding all your changes.

I have a minor tweak I've been working on that I occasionally stash when there's a conflict with a changed file. ('git stash' will set aside uncommitted changes so that you can do a pull when there's a conflict... afterward you can 'git stash apply' to overlay your changes back onto the code)