For one repo I'm using a simple script to regularly commit changes to a file to keep a rather detailed and non-logical history that I'd like to keep for my own statistical purposes (i.e. I know about git rebase, but this non-logical history is something I want to keep anyway). Currently I'm just committing to a separate branch autocommit and use
git checkout master
git merge --squash autocommit
git commit
git checkout autocommit
git merge --ff-only master
for "proper" commits to keep the master branch tidy while maintaining a relationship to the autocommit-branch. So I have a history such as
| * 95e4189 Merge branch 'main' into autocommit
| |\
| |/
|/|
* | 040386a <= created via git merge --squash autocommit
| * 72bc5a5 autocommit
| * 9aaf5a6 autocommit
| * ea758c0 autocommit
| * 7ff1de8 autocommit
But what I really want is to git merge autocommit --edit into master to properly link to the history. However, I don't want to git push anything from the autocommit branch (or any commit with said message, if that is easier to manage). However I guess that will basically corrupt the pushed repo since parts of the commit history will be inaccessible. So my question is either:
- How can I do this anyway? I.e. a kind of
git push --skip autocommit - What should I do instead? The squash-commit version doesn't seem optimal
For visualization, I currently have:
A1 -> A2 -> A3--=> A3' -> A4 -> ... [autocommit]
/ ↓' /
M1-----------> M2 -----> ... [master]
Where ↓' denotes a git merge --squash which means A3 is not a parent of M2 but only M1 is, and A3' just merges back M2 to better keep track of the connection. What I think I want is just
M1--------------=> M2 ---> .... [master]
\ /
A1 -> A2 -> A3 -> A4 (or maybe A3' first merging M2 back) [autocommit]
but none of the commits A1 etc. from the autocommit branch ever getting pushed.