End goal: I want to have files that are tracked by Git, but have those files be the same version for all branches. If you gitignore files, those are the same for all branches, but unfortunately aren't tracked. When I run git push or the like, I need these files to passed between repos, etc.
For example, the data that is in .git folder is typically git-ignored. I want to add some data to my repo so that the data is independent of all branches, but still appears in all branches, and when you clone the repo, the data shows up.
Is this possible? So for example, if the .git dir looks like:
.git/
  branches/
  hooks/
  objects/
  config
  HEAD
  index
I was thinking of adding a folder:
.git/
  .oresoftware/
and putting my data in there, where that data is independent of all branches.
I don't think this will work, because the data in the .git repo isn't really tracked. I am looking for something that's tracked by git, but is the same for all branches...
Update: After reading the answers and thinking about this for awhile, I thought maybe if I amend the initial commit with new files, then it could magically work, but of course that's not how Git works, each commit is a total snapshot, so changing historical commits after the fact won't change newer ones.
Okay, I think I understood your query now. Basically, you need to add the data in a visible folder so that git tracks it i.e. git add <data> in one of the branches and merge this branch to master and then consequently synchronize other two branches with the master (git fetch origin master && git merge origin master). In this particular case, since you added a new file/folder in git, you won't face merge conflicts. Finally, your data will be available in all the branches.
EDIT (based on another user's comment): git cherry-pick <commit-hash> is another way where you can apply a specific commit to a branch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With