开发者

Git development workflow

开发者 https://www.devze.com 2023-02-28 03:44 出处:网络
I am still a bit new on Version Control systems. Currently I have two branches: master and develop. Yesterday I was working on the develop branch and came to realize 开发者_开发百科that what I\'ve ma

I am still a bit new on Version Control systems.

Currently I have two branches: master and develop. Yesterday I was working on the develop branch and came to realize 开发者_开发百科that what I've made was wrong, so I had to switch back to some older commit.

The problem is that in recent commits I've added a couple of new unit-tests and improved considerably some key unit-testing infrastructure classes, that I'll want to keep in my project, even after coming back to an older commit.

This made me realize that maybe what I should have done since the beginning is having a branch related to all those features that are "project related" and not necessarily "current feature" related. Am I right?

How do you handle such things in your daily workflows w/ git?


I would like to recommend the article A successful Git branching model to you, it uses feature branches, develop branch, release branches, and hoxfixes to represent different purpose. And another Git extension you may have interest in is gitflow, it provides high-level repository operations for the branching model mentions in the article.


In this specific case, I'd create a new branch (called ImproveUnitTests) from master then cherry-pick in the commits related to that topic that you've done from development. Then your ImproveUnitTests can easily be merged back into master on its own.

For day-to-day stuff I use a LOT of branches. If I'm developing featureX and see that I need to fix something else, I'll switch back to my master and make a new branch just to fix that stuff. Then merge my "fixit" branch into master, and rebase featureX off that.


If I get you right you want to revert your changes, but keep some of them. In that case I would switch to master and cherry pick the changes that was good (the unit test changes) and then just revert the develop branch and be happy :)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号