Git section in porters handbook seems wrong

I've been reading the git section in the porters handbook in order to make some new ports and things are not working as suggested.

I have added my new ports with
Code:
git add
and then when I try to do a pull as described in the handbook, I get the following:

Code:
git pull --rebase
error: cannot pull with rebase: Your index contains uncommitted changes.
error: please commit or stash them.

What's the correct workflow to add or change files in order to be able to create a diff?
 
It seems to be missing a commit step after you added your files.
 
git add only stages changes for commit. For rebasing local commits on whatever is fetched, you need to commit them first with git commit.

But then, the simplest version is to just do nothing, git diff will then show the diffs from your working copy compared to the latest HEAD. If you want to undo the git add (IOW remove the files from the staging area), you can use git restore --staged.
 
What would be the point of committing the changes, as they will never be pushed anywhere. The real changes will be via the generated diff.

Even if I don't git add anything, the presence of changed files stops the git pull --rebase from happening.
 
How I would do it, is to create a new branch. Do the development in there, add and commit the changes. Then rebase with the main branch before creating a git patch file.
 
It seems that the command in the ports manual to create the diff needs to be changed to:
git diff --cached . > ../`make -VPKGNAME`.diff
This produces a diff of the changes staged for the next commit.

I think I'm going to have to read the whole git manual as it's way more complex than any of the other version control systems that I've used (CMS, CVS, SVN and Mercurial).
 
I also find it challenging.

It's not too complicated when you are managing your own work. If Git or Mercurial already existed when FreeBSD was created, then the Ports would probably have a simpler workflow.
 
Back
Top