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
for context, im mostly using Github Desktop instead of Git CLI (but i do have some knowledge on git cli)
rebasing is what you're looking for
basically replaying your local commits on top of any commits that were pushed to the remote
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
so if i update it will overwrite the whole file (basically deleting my stuff) until i tell it not to?
it won't let you pull if you have unpushed commits afaik
hm
cause it would suck if i just lost all my stuff :SCgetoutofmyhead:
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
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
No, if there's a conflict you'll be prompted to tell it what to keep and what not to