I'm not used to git and I see that I'm not doing the right thing locally. I'd like to know the workflow that would work the best for what I'm doing.
I got the repository from Savannah and each time I want to update it I do a "git pull origin master". If I have worked on some files before that I usually get a message asking me to commit my files otherwise they'd be overwritten. Since I'm not pushing anything to Savannah I feel that committing to the local Master is useless and will only create discrepancies between my repository and Savannah.
Yes, don't commit to local master. A common workflow is to do all work in local branches.
What should I do ? Create a branch where I do all my modifications ?
Yes, exactly. Typically you start with
git checkout master
git pull --ff-only
git checkout -b topic-branch master
# now work on the topic branch
git commit
If the topic branch gets too old, you should rebase it:
git checkout master
git pull --ff-only
git rebase master topic-branch
And then do a git diff to create a patch that I send here ?
Yes, but use git format-patch (or git send-email to send the mail directly):
# Maybe rebase as above
git checkout topic-branch
git format-patch master
When the patch has been applied, what should I do with the branch and the modified files ?
Rebase one more time, then delete the branch:
git checkout master
git pull --ff-only
git rebase master topic-branch
git checkout master
git branch -d topic-branch
If the patch has been applied, the topic branch will be identical to master, and Git will immediately delete it. Otherwise it will not delete it, and there are some changes that are not yet in master.
Once you get commit access to Savannah, you can also push yourself to master:
git checkout master
git pull --ff-only
git rebase master topic-branch
git checkout master
git merge topic-branch --ff-only
git push
This workflow works well, allows you to work on many topics in parallel, and keeps history clean. The maybe somewhat non-obvious rule is to always rebase the topic branches and fast-forward master; you can use 'git config merge.ff only' to disallow all non-fast-forward merges.