Working with git: git equivalent of "svn up -r..."

John Patrick nhoj.patrick at gmail.com
Fri Nov 25 20:14:41 CET 2016


As people have mentioned you can't have different directories at
different commits.

>From what I understand about svn up -r REVISION.

I would do;

$ git stash (backup the current working state)
$ git fetch (fetch the latest remote status)
$ git checkout HASH (checkout out a specific commit)
$ git stash apply (optional step and reapply the current working state)

If your wanting to apply a patch form someone to a specific commit i
would do something like this.

$ git fetch
$ git stash (optional to backup your current working state if you want to)
$ git checkout -b bugfix/XXXX HASH
APPLY PATCH & REVIEW
$ git commit ...
$ git merge origin/master (assuming master is the main branch, so you
get the latest changed)

the either;
$ git push origin --set-upstream bugfix/XXX (push branch to main repo)
submit pull request to merge into master

or;
$ git checkout master
$ git pull
$ git merge bugfix/XXX
$ git push
$ git branch -d bugfix/XXX (clean up local branches)



On 25 November 2016 at 17:47, Brandon Allbery <allbery.b at gmail.com> wrote:
>
> On Fri, Nov 25, 2016 at 12:45 PM, Brandon Allbery <allbery.b at gmail.com>
> wrote:
>>
>> Git doesn't work that way; each directory would need to be a separate
>> checkout. There is no way to operate on only part of a repo.
>
>
> Basically, learn to work with multiple working branches and commit (but not
> push!) often --- the native git workflow --- or start using separate
> checkouts for separate tasks. The independent directories svn workflow will
> not work with git.
>
> --
> brandon s allbery kf8nh                               sine nomine associates
> allbery.b at gmail.com                                  ballbery at sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net


More information about the macports-dev mailing list