Re: three questions: proper forum? & reverting changes to the working directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 8 Nov 2012 08:26:22 -0600
"McKown, John" <John.McKown@xxxxxxxxxxxxxxxxx> wrote:

> 1) is this the proper forum for asking general git usage questions,
> such as "how to"? If not, what is?

This list is okay for the general usage questions.
But since it's the place where the development questions are discussed
as well, and patches get posted, you might find its signal-to-noise
ratio to be not very convenient for a casual user.

For "mere mortals", we have another list, git-users, hosted on Google
Groups [1].  It deals only with problems Git newbies have with Git.

> 2) I am unsure that I did things the "proper" way. I have a git
> maintained subdirectory. I made some changes and saved them in the
> working directory, but did not "git add" or "git commit" them. I then
> decided that I really messed up what I was doing (basically
> reformatting some source code). So to revert the changes back to what
> was last committed, I did a "git reset --hard HEAD". I think this is
> the proper way. But I picked up that command in the section of the
> documentation which was talking about abandoning a "git merge"
> attempt. What I did worked, but is it the proper way? If not, what
> is?

Yes, that was the proper way.  A failed Git merge attempt could be
considered as just another case of a messed-up state of the work tree
and the index.

You might want to read the "Reset Demystified" [2] document for a
friendly descriptions of how different ways to invoke `git reset`
affect the repository, the index and the work tree.
> 
> 3) More generically, suppose I have a file in my working directory
> that I want to put back the way it was "n" commits ago. The best that
> I can see, so far, is "git show HEAD~n:file >|file", replacing the
> "n" and "file" with appropriate values.

`git checkout` is able to fetch specific versions of the specified
files if called like this:

$ git checkout HEAD~n -- filename 

1. http://groups.google.com/group/git-users/
2. http://git-scm.com/2011/07/11/reset.html
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]