Git workflow help

Associate
Joined
19 Jul 2006
Posts
1,847
I'm sure this is quite common but up until recently when I worked on a project it was either on my own or as separate feature requests.

We currently work as a frontend /backend split which is fine, however, if I have worked on branch x pushed then started working on branch y, then the frontend guy wants a small change on x. I am currently having to commit my work on y then check x out update then move back to y.
I could do git stash?

Is there a better way of doing this? It's not the checking out of branches that's really bothering me its the having to open up all the new tabs again for the files I was working on. I'm using VSCode.

I dont think its possible but what I would like to be able to do is have my editor open on branch y. Then open up a new editor or new instance of that editor and work on branch x but i dont think that is possible

How do you do this>
 
Are you working with a local repo or do you have a central server? If the latter, I'd just add the remote to a new directory, check out branch x and open an instance of vscode there to do the work whilst leaving the existing directory alone.
 
Another option is to simply create a new branch whenever you're working on a specific feature or request, rather than working directly on one of the main branches (master, development etc. - however you have it setup).

That way you can simply do a work-in-progress commit on your feature branch before switching back to work on another branch.

Jim
 
Google git flow. As a basic step its a good start, master branch is production code that when pushed to automatically deployes. Development is the same thing but development code (but remains working code

Locally, you feature branch. At my work we name the feature branch after the jira task as we're using the atlassian suite.

When im working on a feature branch, i regularly merge whatever i've branched from (development usually) into my feature branch to ensure i dont get divergence. Then once work is complete, i push the branch. Submit a PR against development that if accepted deletes the branch.

Naturally this is for a company with more people and a desire to have a log and evidence of stuff, code reviews etc, but it can be adapted nicely for any size project and allows integration of project management tools, CI/CD pipelines, scales to increasing developer counts etc.
 
Back
Top Bottom