On 5 November 2016 at 08:39, Ryan Schmidt wrote:
> On Nov 4, 2016, at 12:39 AM, David Bariod wrote:
>> Personnally, I would just commit such change. It is cheap, can be reworked 
>> later and be ketp safe in a private remote repository in case of disaster.
>> With git there are no reason to not commit event not ready yet change set.
> Coming from a Subversion background, where you commit when you are finished 
> with your work and not before, this reversal is very difficult for me to 
> grasp.
> I don't know how to rework a commit later.
> I don't know how to, let's say, commit my unfinished work on curl, then make 
> changes to libpng and commit them, and then push only the finished libpng 
> commit and not the unfinished curl commit to upstream.

# create a new branch for temporary work on curl
git checkout -b playing-with-curl
# same as:
# git branch playing-with-curl && git checkout playing-with-curl

#add temporary changes
git add net/curl/Portfile
git commit
<enter the commit message>

# you could (optionally) do your libpng-related work in a branch as well
# users without commit rights or any developer wanting to submit a pull request
# for review before committing have to do this anyway;
# you you do this in master
git checkout -b fix-for-libpng
# add and commit changes
git add graphics/libpng/Portfile
git add graphics/libpng/file/the-patch-you-just-added.diff
# review changes
git diff --cached
git commit
<enter the commit message>

# go to master and pull the latest changes
git checkout master
git pull --rebase

# if you did your work on libpng in master, you are then set

# else go to your libpng branch and rebase the changes on top of the
latest master
git rebase master
# I don't want to give wrong instructions here, but I suspect that even
# "git push origin master" works in this case

Then, when you want to resume your work on curl:

git checkout playing-with-curl
<do your stuff>
git add net/curl/Portfile
git commit
<do more stuff>
git add net/curl/files/some-fix.patch
git commit

# at any point you can also do
git rebase master

Now you have three or more commits. Check with "git log". You can
merge them with

git rebase -i HEAD~3

This will open a new editor and you have to replace "pick" with "squash". See
or google for other examples.

macports-dev mailing list

Reply via email to