[Kde-pim] Re: Pushing a single commit in git

David Jarvie djarvie at kde.org
Mon Jan 3 23:24:27 GMT 2011


On Monday 03 January 2011 22:31:17 Kamil DomaƄski wrote:
> On Monday 03 January 2011 23:00:18 David Jarvie wrote:
> > I've alread committed various changes, including the single one I want to
> > push. Is there any way to create a new branch without any of my local
> > commits, so that I can then apply the change to the single file in the
> > local repository, and then push the change for that file only? Or would I
> > have to download the whole repository again before making that change?
> 
> I'm by no means good at git, but this might help:
> 
> Find out the hash of the latest "official" commit in your repo. Let's say it's 
> abc123.
> 
> $ git branch -m master mybranch
> Should rename the master branch to mybranch.
> 
> $ git checkout abc123 -b master
> Should create a new master branch, ending with the last official commit, 
> therefore theoretically identical to untouched master.
> 
> Let me know if my guess was right.

I managed to push the commit by following your instructions above, and then used cherry-pick (thanks, Alex) to commit the relevant change into my local master, which I could then push.

The important thing to learn from this is, as Christian said, to do all local work in branches and reserve the local master branch for tracking the repository.

Thanks everybody for your help.

-- 
David Jarvie.
KDE developer.
KAlarm author -- http://www.astrojar.org.uk/kalarm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20110103/434ac0b1/attachment.sig>
-------------- next part --------------
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/


More information about the kde-pim mailing list