Newbie msysgit question


Questions, Explanations, Howtos

cjo

Spider Stomper

Posts: 217

Joined: Tuesday, 20th September 2011, 02:03

Post Thursday, 11th April 2013, 17:44

Newbie msysgit question

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?

Dungeon Master

Posts: 1531

Joined: Saturday, 5th March 2011, 06:29

Post Thursday, 11th April 2013, 17:50

Re: Newbie msysgit question

  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

For this message the author mumra has received thanks:
cjo

cjo

Spider Stomper

Posts: 217

Joined: Tuesday, 20th September 2011, 02:03

Post Thursday, 11th April 2013, 18:02

Re: Newbie msysgit question

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!

Vestibule Violator

Posts: 1567

Joined: Friday, 21st January 2011, 22:56

Post Thursday, 11th April 2013, 20:03

Re: Newbie msysgit question

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.

cjo

Spider Stomper

Posts: 217

Joined: Tuesday, 20th September 2011, 02:03

Post Friday, 12th April 2013, 12:22

Re: Newbie msysgit question

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. :) )

Ziggurat Zagger

Posts: 3163

Joined: Friday, 6th January 2012, 18:45

Post Friday, 12th April 2013, 12:44

Re: Newbie msysgit question

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)

Return to Coding

Who is online

Users browsing this forum: No registered users and 15 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.