On Thu, Jul 08, 2021 at 10:56:39AM +0300, Konstantin Khomoutov wrote: [...] > > Hello. New member with first post here. For about a 2 years I've been using > > a one-person git system (on Bitbucket). Nothing fancy. Mainly to maintain > > an audit trail of changes to about half a dozen text files, and to make > > sure I could always get the most current version when working at disparate > > computers in different offices, on two different operating systems (Windows > > 10 and Linux Mint). > > > > I am now in an awkward situation that may best be described > > diagrammatically, below. Is there any good, git-centric way to get my > > colleague's added lines (colleague's "file Q") into my main document > > (called "file A" in master; called "file Z" in withindex) [...]
While we're on this, I'd recommend to employ this "trick", which I have basically outlined in my first response, to deal with "external" changes. When you give out to someone a set of files to modify, consider doing the following. First, create a branch off the point which contains the state of the project which you wish to give away. Grab the files at point. You can either check out the created branch and mess with the files after they have been updated in the repositories work tree (the directory on the file system in which you work on the project's files), or be creative and make yourself accustomed with the `git archive` command which is able to create, say, a Zip archive right from the specified commit, tip of a branch etc. Then hand the prepared files off to another person. Consider asking them to not rename the files - this will make later re-integration of their changes easier. Once the person hands the updated files back to you, you do the following. Check out the branch created before preparing the files, and merely dump the files your collaborator sent to you into the work tree - owerwriting what's there. You then run `git status` and `git diff` to see what the changes are: the latter command will display the changes in the files which were not renamed, and the former will help you see whether your collaborator had renames something - such files will appear as untracked. You can easily fix up this situation by moving (using your Operating System's facilities) the renamed files _over_ the original files, and the changes will then be seen through the `git diff` command. Once all the necessary fixups are done, `git add`, and commit. You then need to integrate the changes now recorded in that side branch back into the branch you condider to be main (looks like it's "master" in your case). As usually, there are multiple approaches to this - simple merging, cherry-picking, rebasing followed by "fast-forward" merging. -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/git-users/20210708082802.rilwwlp4ih54iqjg%40carbon.