git: cb632051dc - main - porters-handbook: Fix the Git process in Chapter 11.1

Guangyuan Yang <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.doc
Message-ID <[email protected]>
The branch main has been updated by ygy:

URL: https://cgit.FreeBSD.org/doc/commit/?id=cb632051dc2b42ea8c8b92792867eba19a894905

commit cb632051dc2b42ea8c8b92792867eba19a894905
Author:     Guangyuan Yang <[email protected]>
AuthorDate: 2021-05-26 04:08:47 +0000
Commit:     Guangyuan Yang <[email protected]>
CommitDate: 2021-05-26 04:11:49 +0000

    porters-handbook: Fix the Git process in Chapter 11.1
    
    In Chapter 11.1 Using Git to Make Patches, there are multiple issues
    with the process:
    
    - `git pull --rebase` will refuse to work if there are any staged or
      unstaged changes, so the users are unable to update the repo to the
      latest.
    - `git diff` does not work for staged changes, need to add `--staged`.
    
    This commit attempts to address the above.
    
    PR:             256122
    Reported by:    Neal Nelson <[email protected]>
    Reviewed by:    bcr, PauAmma <[email protected]>
    Differential Revision:  https://reviews.freebsd.org/D30422
---
 .../en/books/porters-handbook/upgrading/_index.adoc  | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/documentation/content/en/books/porters-handbook/upgrading/_index.adoc b/documentation/content/en/books/porters-handbook/upgrading/_index.adoc
index 94e011f752..e1f39815f3 100644
--- a/documentation/content/en/books/porters-handbook/upgrading/_index.adoc
+++ b/documentation/content/en/books/porters-handbook/upgrading/_index.adoc
@@ -90,7 +90,7 @@ When possible, please submit a man:git[1] diff. They are easier to handle than d
 [source,shell]
 ....
 % git clone https://git.FreeBSD.org/ports.git ~/my_wrkdir <.> <.>
-% cd ~/my_wrkdir/dns/pdnsd
+% cd ~/my_wrkdir
 ....
 
 <.> This can be anywhere, of course. Building ports is not limited to within [.filename]#/usr/ports/#.
@@ -108,19 +108,29 @@ While in the port directory, make any changes that are needed. If adding, moving
 
 Make sure to check the port using the checklist in crossref:quick-porting[porting-testing,Testing the Port] and crossref:quick-porting[porting-portlint,Checking the Port with `portlint`].
 
+Before making the patch, fetch the latest repository and rebase the changes on top of it.
+Watch and follow the output carefully.
+If any of the files failed to rebase, it means that the upstream files changed while you were editing the same file, and the conflicts need to be resolved manually.
+
 [source,shell]
 ....
-% git status --short
-% git pull --rebase <.>
+% git fetch origin main
+% git rebase origin/main
 ....
 
-<.> This will attempt to merge the differences between the patch and current repository version. Watch the output carefully. The letter in front of each file name indicates what was done with it.
+Check the changes staged for the patch:
+
+[source,shell]
+....
+% git status
+% git diff --staged
+....
 
 The last step is to make a unified man:diff[1] of the changes:
 
 [source,shell]
 ....
-% git diff . > ../`make -VPKGNAME`.diff
+% git diff --staged > ../`make -VPKGNAME`.diff
 ....
 
 [NOTE]
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-doc-all
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.