Need help with GIT logic

So I need some help with git functionality my workflow: im working using a feature branching workflow with multiple people the general structure goes something like this (branches): Dev (anything that is still in development) -> beta (optional) -> Release The way we work is by creating branches that describe our features on top of Dev, once we are done we merge my problem: how can i ensure/update my feature branch from the latest dev branch without losing my code, if the same file was edited for example and more specifically does git just overwrite the entire file or will it leave my functions etc. alone
9 Replies
SCShocked from Human Resources
for context, im mostly using Github Desktop instead of Git CLI (but i do have some knowledge on git cli)
Jimmacle
Jimmacle3mo ago
rebasing is what you're looking for basically replaying your local commits on top of any commits that were pushed to the remote
mg
mg3mo ago
You can rebase or merge to update it onto the latest dev commit If a file has been changed on both you'll get a merge conflict, which you can resolve manually You'll have to explicitly tell it what to keep and what to throw away
SCShocked from Human Resources
so if i update it will overwrite the whole file (basically deleting my stuff) until i tell it not to?
Jimmacle
Jimmacle3mo ago
it won't let you pull if you have unpushed commits afaik
SCShocked from Human Resources
hm cause it would suck if i just lost all my stuff :SCgetoutofmyhead:
Jimmacle
Jimmacle3mo ago
that should never happen because you're regularly pushing your feature branch to github the worst you can do is blow up your local copy if you really want to be safe, make a backup of your local copy beforehand
SCShocked from Human Resources
oki ill leave this thread open for now, in some hours the first merge (that i need to pull into my branch) should happen, so ill leave it for followup questions
mg
mg3mo ago
No, if there's a conflict you'll be prompted to tell it what to keep and what not to