Thank you for the answer. There's something I still don't get. Keeping the previous example
cd doc git log commit 03e590759409e0671641eb6ebd8965fd7771dd5c Author: Valerio Pachera <siri...@gmail.com> Date: Mon Jan 13 08:08:03 2014 +0100 changed first line commit c0951a06f8bdd4d659dc356cfef77574d9ead2f4 Author: Valerio Pachera <siri...@gmail.com> Date: Mon Jan 13 08:07:15 2014 +0100 first commit cd ../doc_clone git log commit b899d48dcfd6e47d22d4835f21c28dcce9fe83a5 Author: Valerio Pachera <siri...@gmail.com> Date: Mon Jan 13 08:10:20 2014 +0100 changed first line commit c0951a06f8bdd4d659dc356cfef77574d9ead2f4 Author: Valerio Pachera <siri...@gmail.com> Date: Mon Jan 13 08:07:15 2014 +0100 first commit I tried to apply the patch and then run 'git commit' with the exact same comment. As I expected, the hash of the second commit is different from the original repo. This is the simulation of sending a patch by mail that gets merged into github repository. If update my repository after the patch has been merged by 'git pull', my local copy may show something like this: commit 79cbabe367fba0d9286e133ea7dc6daaf19a8924 Merge: b899d48 03e5907 Author: Valerio Pachera <siri...@gmail.com> Date: Mon Jan 13 08:21:38 2014 +0100 Merge ../doc commit b899d48dcfd6e47d22d4835f21c28dcce9fe83a5 Author: Valerio Pachera <siri...@gmail.com> Date: Mon Jan 13 08:10:20 2014 +0100 changed first line commit 03e590759409e0671641eb6ebd8965fd7771dd5c Author: Valerio Pachera <siri...@gmail.com> Date: Mon Jan 13 08:08:03 2014 +0100 changed first line commit c0951a06f8bdd4d659dc356cfef77574d9ead2f4 Author: Valerio Pachera <siri...@gmail.com> Date: Mon Jan 13 08:07:15 2014 +0100 first commit I simulated that locally: doc_clone$ git pull ../doc remote: Counting objects: 5, done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 1), reused 0 (delta 0) Unpacking objects: 100% (3/3), done. >From ../doc * branch HEAD -> FETCH_HEAD Is this the right procedure? > Apply a patch to files and/or to the index so you also get to choose if the patch changes should even be implicitly 'added'! The 'index' is the content oh .git right? So the history... What do you mean exactly by 'implicitly added'? Does that mean it also creates a commit? If yes, which option do I use? I read the manual and tried using '--index' but it wasn't that. 2014/1/12 Philip Oakley <philipoak...@iee.org> > ----- Original Message ----- > > *From:* Valerio Pachera <siri...@gmail.com> > *To:* git-users@googlegroups.com > *Sent:* Sunday, January 12, 2014 5:48 PM > *Subject:* [git-users] The right process of generating and merging > patches? > > Hi all, this is my first topic in this group. > I'm not professional programmer, I mostly write scripts. > I'm interested in git because I'm collaborating with an open source > project writing documentation. > So I wish to get familiar with git work-flow process to send patches. > I'll probably use it also in the next future for my scripts. > > Here's my first question about patch generation and merge: > > I have just a single file named "doc.txt" in the directory "doc" > I run > > cd doc > git init > git add doc.txt > git commit -m 'first commit' > > I clone the repository > > cd .. > git clone doc doc_clone > > cd doc > <I edit the first line changing some stuff> > git add doc.txt > git commit -m 'changed first line' > git format patch -1 > > cd ../doc_clone > git apply ../doc/0001-changed-first-line.patch > > I see the patch ha been applied but when I run 'git log' I don't see any > new commit. > I was expecting that, applying a patch, would automatically generate a > commit. > > Guessing that I'm the maintainer of the project, what would it be the > right process for merging single patch or a series of patches? > > The 'git apply' should be thought of as just being like 'git add'. > > You may have other local changes to be done before you nake a commit, > so your missing step is to do a 'git commit' to recored those changes. > > The 'git apply' man page's synopsis > https://www.kernel.org/pub/software/scm/git/docs/git-apply.html, also > notes - Apply a patch to files and/or to the index so you also get to > choose if the patch changes should even be implicitly 'added'! > > Philip > -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.