Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ptp-dev] Replace with latest from HEAD

Hi ,

On Mon, Jan 23, 2012 at 11:52 AM, Jeffrey Overbey <jeffreyoverbey@xxxxxxx> wrote:
Hi (Roland, probably),

When we used CVS, you could use "Replace With > Latest from HEAD" to
completely reset a project to its state in HEAD -- it would overwrite
any local changes, delete any added files, add back any deleted files,
etc.

In EGit, there's a "Replace With > HEAD Revision," but it doesn't work
the same way (at all).  I want to reset both the index and the working
copy.

If you have changes in the workspace and you haven't added them yet to the index it should be enough to do "Replace With" or "git checkout {files and or directories}" on the command line. If you have already added it to the index you first need to first reset the index. Resetting the index just undoes the "git add". Thus the file doesn't change in the workspace. But it isn't marked for commit anymore (it changes in the index). You can do this with Egit using Reset->Mixed. But that always applies to the full repository. But since "Mixed Reset" doesn't change the files it might not be a problem to reset the whole repository (unless you use the index for staging). 
On the console you can reset individual files (git reset {files or directories}). On the console you can also revert both the index and the working directory in one step using: git checkout HEAD {files or directories}.

 
The best I could figure is to delete the project, then git checkout
that_project.

Something like "stash, then reset --hard, then stash apply" seems
ideal, but AFAIK these apply to your whole repository, not just one
tree. 

Of course, I can't find an EGit equivalent for either of these.
Yes Egit doesn't have stash yet. It has Reset->Hard.
 
 (EGit
also failed miserably when a rebase had a conflict... so I'm learning
to use EGit only for "happy case" scenarios and fall back to the
command line when things go wrong...)
Yes I also woudn't use Egit for rebasing yet. But then again I wouldn't recommend to use rebase at all - unless you are already somewhat of an Git expert (i.e. have read most of ProGit - highly recommnded if you want to really  understand Git). Rebase makes it VERY easy to shoot yourself in the foot.
 
So... what's the "right" way to do this?  Can I stash and/or reset
--hard just part of the repo?  
No.
 
Should I feel guilty for abandoning
EGit?
Don't ;-) Some things are still easier to do on the command line. I.e. I would get super confused for complex things without "git status".
 
P.S. I look forward to the fact that all of my embarrassingly naive
git questions are being publicly archived for the rest of eternity.
Apologies, future self...
You can find questions from me in newsgroups from over 10yrs ago .. Please don't look ;-)

Roland
 
_______________________________________________
ptp-dev mailing list
ptp-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ptp-dev







--
ORNL/UT Center for Molecular Biophysics cmb.ornl.gov
865-241-1537, ORNL PO BOX 2008 MS6309

Back to the top