Bash script - Split commits for specific folder modifications #22417
-
Hello, I want to create a bash script for manipulating local git history. The goal is to modify current branch work (in all commits differing from main branch) and split modifications from a specific folder in a different commit. Imagine a repo : The developer create a new feature branch from main branch git checkout -b new-feature He will modify ./src/mycode.php in commit “c1” Then modify ./src/mycode.php and ./translations/platform-en_devel.xliff in commit “c2” And modify again ./src/mycode.php in commit “c3” I need to get all modifications made in translation folder and commit them on main branch I think of a creating a bash script who will :
Another approach I see is
I have to check github hooks maybe this can help me. Is it possible ? Has anyone seen this type of script that I could build on? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I’ve done things like this in various ways… You can do something like:
(You’ll want to read about Note: You need to be careful about additions and removals, the above will do the wrong thing (and mode changes for that matter). You could also play w/ |
Beta Was this translation helpful? Give feedback.
-
Big thanks for the moment I’m using this :
|
Beta Was this translation helpful? Give feedback.
I’ve done things like this in various ways…
You can do something like:
(You’ll want to read about
..
to make sure it’s doing what you want.)Note: You need to be careful about additions and removals, the above will do the wrong thing (and mode changes for that matter).
You could also play w/
git checkout
+git reset
instead ofgit diff
if you’re being adventurous.