-1

I have a question about using them, so i don't know how can i explain the question but i'll use a scenario so you can understand me.

I started a repository and my partner told me we have to use branches so we can work without any problem(replacing any code using git add --all) and we will working with a base "copy" of the project.
So if he adds for example a folder with php files, he must do it in the master branch? or i can access to his branch and get those files?
Thank you

QuickAccount123
  • 179
  • 1
  • 5
  • 15

3 Answers3

1

you should always push the changes to your local branch and than merge it to the master.you don't have to use his branch.your partner can push the changes to master and you should be able to rebase/merge from the master...

1

You can fetch files from any branch at any point in time. But when you pull from another branch you need to make sure any changes made in the current branch is committed before you pull from your partner's branch.

You can also look at Git tree answer which explains how git branch is like a tree and you can switch between two points at any point.

1

I will explain the basic behind the branching in git.

A branch represents an independent line of development. Branches serve as an abstraction for the edit/stage/commit process. You can think of them as a way to request a brand new working directory, staging area, and project history. New commits are recorded in the history for the current branch, which results in a fork in the history of the project.take a look

From your master repo you create a separate branch and after your work is complete, you first commit to your branch--> Push the code to Remote repository -> after review, you can merge it back to master. This way everybody has his independent workspace and all developers can work in parallel.enter image description here

Sangam Belose
  • 4,262
  • 8
  • 26
  • 48