I'd like to have a git repository with a branch for development and a branch for deployment. I have several configuration and database files that my project needs. I want the deployment branch not to have any configuration or database files for my project, but I want to keep versions of those files in my development branch in order to be able to test. Is there any way, when merging the development branch into the deployment branch, to have the merge process ignore those files?
Roughly speaking, you use git rebase -i to get the original commit to edit, then git reset HEAD^ to selectively revert changes, then git commit to commit that bit as a new commit in the history.
The Usage of Git Merge The git merge command is targeted at combining two branches. You can also use it for merging several commits into a single history. The merge commits involve two parent commits.
In Conclusion. We can use git checkout for far more than simply changing branches. If we supply it with a branch name and a file, we can replace a corrupted or broken file. Instead, if we want to pass some of the changed content we can use the --patch flag to manually merge an individual file.
To merge branches locally, use git checkout to switch to the branch you want to merge into. This branch is typically the main branch. Next, use git merge and specify the name of the other branch to bring into this branch. This example merges the jeff/feature1 branch into the main branch.
You could use git merge --no-commit
and delete the config files before committing the merge. There might be more streamlined possibilities, though.
However, I'd recommend either having the files in both branches or not having them at all. What language and development environment are you using? Do they offer some possibility for specifying different files depending on what kind of build you are trying to make?
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