Re: Unable to Revert Commit

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

 



Rex:

On Thu, Nov 27, 2014 at 11:35:57AM -0500, Rex Macey wrote:
> "Unable to Revert Commit ... Resolve the conflicts in your working
> directory and commit them before trying the revert again".  Please
> help me understand how to resolve the conflicts.  Here's what
> happened (as best as I remember).
> Created a windows folder "github_learn" (not under my
> \documents\github  folder) ;
> Created a file file1.r.
> Dragged folder into Github for Windows.  Committed; I could see the
> file in my directory, Github for Windows, and on the server
> (github.com);
> I modified the first file.  Checked that there were different
> versions and then committed it.;
> I created a second file, file2.r Committed it.  All good.;
> Then I tested whether I could retrieve the first version of file1.r
> (before modification).  In the History area of Github for Windows, I
> can see this version.  I click on that, and then I click on "Revert"
> which produces the error.
> 
> I am very new to Git and have read some of the documentation and
> this exercise is my attempt to test myself.  So far my grade is not
> good.  I appreciate any guidance including links to instructions.

"GitHub" and "GitHub for Windows" are not "Git". I don't think
you will find official support for those proprietary products on
this mailing list (I may be wrong). It looks like you can request
support for those products from the "contact" page on the GitHub
Web site: https://github.com/contact.

My personal recommendation would be to get rid of those anyway
and learn to use the real Git. It's not very difficult, and it is
likely to do things better in the long run. As a general rule,
GUI programs are limited, clumsy, and try too hard to hide the
details of what they are doing from you that you need to
understand to effectively use the software. Do not fear the
command line. It is just like writing code. If you are interested
in Git then you are probably interested in code. Think of the
command line interface as a more direct interface to tell the
computer what you want with high-level code instead of expensive
graphics and event loops and spaghetti code.

I can tell you that git-revert(1) basically means "create new
commits that undo the changes introduced by the specified
commits." That is likely accomplished by applying a reversed
patch, and that is likely to fail if the tree (files) has changed
much.

Conflicts are OK! They are normal when you work with version
control software. You can manually resolve the conflicts and
continue with the revert. Google can help you to understand how
to resolve conflicts. You can do so manually (my preference, and
a good thing to learn to help you understand why conflicts
occurred in the first place) or you can use software tools to
help. I recommend you create backups of your repository (.git)
and working tree (...folder where your files are) using something
like 7-zip (but a simple copy suffices) when you're new to Git so
that if you make a wrong move it's easier to go back and try
again with confidence.

That said, if you just want to *see* the state of the file at a
particular point in history you can use git-cat-file(1). Another
way would be (with a clean tree) git-checkout(1), though that
will make changes to your tree (and if you aren't careful can
destroy changes that you have already made) that you may not
want. The file can be restored to the "latest" committed version
using git-checkout(1) again (or git-reset(1) with the --hard
option). Both of these options need to be used with care. In this
case, git-reset(1) could also be used to reset the state of your
working tree to a clean state if you do decide that git-revert(1)
isn't what you wanted.

I recommend that you just find a plain Git tutorial and learn to
the use the real thing. It's really not that hard. And "Git for
Windows" works well without the need for GitHub's own
proprietary, platform-specific solution. It even includes a Git
GUI if you're still reluctant to use the command line (but my
above wisdom regarding GUIs probably still applies).

If you use the real Git then not only can we help you, but you
can get real-time advice and guidance from the #git channel on
irc.freenode.net.

Regards,


-- 
Brandon McCaig <bamccaig@xxxxxxxxx> <bamccaig@xxxxxxxxxxxxxxxx>
Castopulence Software <https://www.castopulence.org/>
Blog <http://www.bamccaig.com/>
perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }.
q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.};
tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say'

Attachment: signature.asc
Description: Digital signature


[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]