I've just recently started using Git, I'm working on my own and I'm still learning how it all works.
A potential issue I'm wondering about is if the same file is being worked on in two branches at once. For example a style sheet.
Say a new page for a website is being developed in branch1, and a second in branch2. Both have been complete with the relevant css added to style.css, and need to be merged to master.
If branch1 is merged then the stylesheet in master would be updated with the new styles. But then if branch2 is merged after wouldn't the css added in branch1 be overwritten?
Is there some way around this?
Edit:
I have tested this by creating a test.txt file:
hello world
Then created branch1 and edited the file to:
hello world
added change test1
Then created branch2 from master and similarly edited to:
hello world
added change test2
I merged branch1 into master without issue. But when I tried to merge branch2 I get a conflict error. Fix conflicts and then commit the results.
What would be the best way to correct this? Would I just start branch2 from scratch with the branch1 changes?