2
Next, the scenario is: In my work there is a project with only one branch to master. They had commits that broke the version that was in production. So when I took the project, I needed to clone the project into a specific commit. So I did, cloned in a specific commit, added new features. I have some questions, for example:
- How do I upload my version without giving conflict? I thought about creating a new branch but would lose the history, I would just remove all those commits that broke the application and go back to the version I downloaded, so I can commit.
- Have two branches? Like a master and one for development?
- What else can I do?
"Have two branches? Like a master and one for development?" for sure, actually even more, development, testing, homologation and production. What’s the problem of losing history of errors, if commits have broken the application have to have them saved?
– Costamilam
If you search for "git workflow" you will see that there are numerous different possibilities, then "best practice" depends on each case. But I don’t think you’re taking advantage of one of the great advantages of git, which is that you can have multiple branches, since they’re "cheap" and easier to merge compared to svn, for example. And you always have a copy of the entire repository, there is no fear of losing history - although even history is not considered "sacred" to the followers of rebase: https://www.atlassian.com/git/tutorials/merging-vs-rebasing
– hkotsubo