This is mainly note to self, how to rebase one package
(rhn-client-tools) while keeping the rest of the git repository
intact.

The initial situation is:

        - we are in some branch, let's assume in master;
        - we want to rebase content of the directory
          client/rhel/rhn-client-tools from branch b while keeping the
          rest of our master the same.

$ git merge -s ours --no-commit b
$ git rm -r client/rhel/rhn-client-tools
$ git read-tree --prefix client/rhel/rhn-client-tools 
b:client/rhel/rhn-client-tools
$ git show b:rel-eng/packages/rhn-client-tools > 
rel-eng/packages/rhn-client-tools
$ git add rel-eng/packages/rhn-client-tools
$ git commit -m 'Rebase rhn-client-tools to latest from branch b.'
$ git reset --hard HEAD

The steps with rel-eng/packages/rhn-client-tools allow us to modify
yet another file outside of the client/rhel/rhn-client-tools
directory. Which is useful with Spacewalk because the version of
rhn-client-tools in branch b will become visible and latest in master
as well.

After these steps and before git push, I recommend running gitk --all
or similar and review what happened.

In addition, I recommend to run checks like

$ git diff origin/master..master | grep ^diff \
        | grep -v 'diff --git a/client/rhel/rhn-client-tools/'

which in our case should only show rel-eng/packages/rhn-client-tools
-- nothing else besides that file and the client/rhel/rhn-client-tools
directory should have changed in the master.

And against branch b

$ git diff b..master -- client/rhel/rhn-client-tools

which should show nothing, as the whole subdirectory in master should
have been correctly overwritten (rebased) to what we have in b.

-- 
Jan Pazdziora
Principal Software Engineer, Satellite Engineering, Red Hat

_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to