I have cloned a repository and the master
branch in my repo is tracking origin/master
. I created a work
branch and changed some config files specific to my dev machine to make the app work.
My normal workflow will be to switch to master
branch, merge changes made in work
branch and push
those changes upstream. The problem is that i don't want my specific chnages to get pushed. When i merge my work
branch into master
those changes are merged also.
The only solution I've found so far is not to commit those changes in work
but that's not a satisfactory solution.
One thing to note is that by default, git fetch will only bring you changes from the current branch. To get all the changes from all the branches, use git fetch --all . And if you'd like to clean up some of the branches that no longer exist in the remote repository, git fetch --all --prune will do the cleaning up!
To find it go to Settings > Branches > Branch Protection Rules and click 'Add Rule'. Then, enter the name of the branch you want to protect and click the checkbox to require pull request reviews before merging.
No, git push only pushes commits from current local branch to remote branch that you specified in command.
If you want to prevent committing (therefore also pushing) these local config files, you could use git update-index --assume-unchanged. Files marked with this flag will be assumed to never change (until you reset the flag with --no-assume-unchanged)
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