Esteemed Git users,
These post's appear to answer my question, but either i'm too new to Git to grasp & execute them correctly, or they don't in fact answer my question:
- partly cherry-picking a commit with git
- How to git-cherry-pick only changes to certain files?
- Git: Best way to add only some parts of a file from another branch?
As the title indicates, i have a file, X, on branch1 and file X' on branch2. File X' was branched a few commits ago (to both file's X & X') from file X and i also changed the file name (i.e., from X to X'). The file's remain largely the same. What i'm trying to achieve is bring some of the changes made to file X over to X'. The changes are limited to two commits, commit_a and commit_b. Ideally (& optionally) i'd like to invoke my merge tool to manually accept (or not) specific lines of code within each commit_a and commit_b when applying them to X'. Is this possible and if so how? FWIW, I'm only using Git locally; no interaction with other collaborators/repositories. Trying to apply answers from the aforementioned posts, i could not focus only on the files of interest (branch1 X & branch2 X') - Git kept involving other files in the two branches, including files Y and Z (of both branches) as well as X in branch2, but never X' in branch2. I also want to keep branches1 & 2 separate so i don't see how the merge command would work here.
Being new to Git (and version control) i also question if my workflow is some how responsible for failing to achieve my objective here.
Patient exampled answers greatly appreciated!
Karl