[OpenAFS-devel] Re: [AFS3-std] Quota for max. number of files per volumes

Simon Wilkinson sxw@inf.ed.ac.uk
Thu, 23 Jul 2009 15:46:02 +0100


On 23 Jul 2009, at 14:54, Jeffrey Hutzelman wrote:
>
> Simon, I'm actually expecting that it's going to be a common problem  
> that people do development in a series of private commits, and then  
> want to submit the result as a single change.  It might be useful to  
> document how to do this, short of using --amend on each commit on  
> the private branch, which essentially throws away revision history  
> while still in development.

If you want to go from multiple commits to a single one, then you need  
to throw away history somewhere along the line. There's a few ways  
that you can go about doing this, mainly depending on whether you want  
to preserve the individual commits in your local tree.

Firstly, I strong recommend using git log origin/master..HEAD to see  
what you're about to push. This is the best way of seeing how what  
you've got in your local tree will look to gerrit. If you find that  
you've got merge commits, or the breakdown of commits seems  
inappropriate to you (remember "one commit per change; one change per  
commit"), then follow the notes below, before pushing.

If you want to keep your local history (for sentimental value, say),  
then you need to copy the local changes into a new branch before you  
modify them. You can do this either by noting the SHA1-ids for each  
change given by git log, and using git cherry-pick to pull these  
changes into a new branch, or by using git diff to generate a diff  
between your original topic branch and origin/master, and by applying  
that to a new branch.

If you've still got changes that you want to collapse together, or  
merge commits you need to squash, then you need to rebase. Running git  
rebase -i origin/master will give you an editor window with a list of  
commits, something like:

pick dc201c6 Minimise crref() and add a fastpath for cache hits
pick 21c8157 Use readpage, not read for pastpath access
pick 819a165 Add support for blocking readahead
pick 633d130 Add support for background page copies

If you reorder the order of the lines in this file, then the order  
they are in your commit history will be changed. If you delete a line  
from that file, then that commit will be deleted from the branch.  
Changing 'pick' to 'squash' for a given entry will cause that commit  
to be merged with the one immediately before it. Rebasing will also  
remove all of the merge commits (as the rebase makes a copy of the  
commit into this branch, rather than using a merge commit to pull in a  
different branch).

Once you've done this, and verified that your new tree looks sane with  
'git log origin/master..HEAD', you can push into gerrit.

Hope that helps!

Cheers,

Simon.