简体   繁体   中英

Git workflow for dev and production

I'm trying to figure out a workflow for a git.

I have one codebase, with two branches (development and production). This is for a web app, so development has config files, task runners etc. and production is just the files I need on my server (eg minified scripts and stylesheets).

What I would like to do is be able to work locally (so I will be in the development branch), and when I am ready to push to my server, I would run my build tasks necessary and push to the production branch. This way both branches stay in sync with each other, bar production not having some unnecessary files that development has.

Attempting to do this with git merge , but there will always be a conflict as production tracks files development does not. Is it possible, without manually listing all the files, to merge/sync a branch with another, whilst retaining both branches and git not looking for files which do not already exist within the branch I am attempting to merge to?

I hope this makes sense, thanks

When you wan to merge development branch into production branch and auto solving the merge conflicts files. You can use

git checkout production
git merge development -X theirs

So after finishing merge, your production branch will have the latest config files, task runners etc as the development branch has.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM