home | list info | list archive | date index | thread index

Re: git pull vs svn up

To "throw away modifications in your sandbox" you don't have to
git pull (or git fetch, as I prefer to do).  You can:

    git reset --hard HEAD

It will make your workspace match the HEAD commit on the current
branch.  It will not remove files that are not being tracked.  For
that you need

   git clean

At this point, you still need to git pull (or

   git fetch
   git rebase remote-tracking-branch
   
as I prefer) to get the remote changes.

bjb


On Sat, Jul 13, 2019 at 10:14:41AM -0400, Robert P. J. Day wrote:
> On Sat, 13 Jul 2019, J C Nash wrote:
> 
> > For my own work I mostly use svn since I have it well-established on
> > my uottawa VPS. However, I'm using gitlab for a project I share with
> > others.
> >
> > Am I correct that
> >
> >   git pull
> >
> > will NOT restore files that have somehow been deleted or renamed?
> 
>   i'm not sure how to best clarify this, but git has a very different
> model of committing changes in that, when you clone a git repo, you
> get the *entire* history of the repo. what this means is that, as part
> of a normal git workflow, since you have that entire history, you're
> expected to fix any "oopses" *locally* -- perhaps with having made
> your changes on a local branch, perhaps checking out a deleted file
> from another branch that still contains the file, or perhaps doing a
> "git reset --hard" or "git revert" to undo the effect of said
> deletion.
> 
>   the git push/pull/fetch commands are most emphatically *not*
> designed to fix oopses in your local repo -- they are meant for
> exchanging new content between repositories. except in very rare
> circumstances (total meltdown of local repo, for example), it is not
> some other repository's responsibility to help you recover from
> simple local mistakes like deleting a file.
> 
> rday
> 
> -- 
> 
> ========================================================================
> Robert P. J. Day                                 Ottawa, Ontario, CANADA
>                          http://crashcourse.ca
> 
> Twitter:                                       http://twitter.com/rpjday
> LinkedIn:                               http://ca.linkedin.com/in/rpjday
> ========================================================================
> 
> To unsubscribe send a blank message to linux+unsubscribe [ at ] linux-ottawa [ dot ] org
> To get help send a blank message to linux+help [ at ] linux-ottawa [ dot ] org
> To visit the archives: https://lists.linux-ottawa.org
> 
---end quoted text---

To unsubscribe send a blank message to linux+unsubscribe [ at ] linux-ottawa [ dot ] org
To get help send a blank message to linux+help [ at ] linux-ottawa [ dot ] org
To visit the archives: https://lists.linux-ottawa.org

references

message navigation