2. Multiple users working on the same branch.
If two or more users are using the same repository to push code into, there will be conflicts. In order to resolve the issues checkout the steps below.
Let's take an example. Suppose that you already have a codebase in GitHub
|-- master
|-- dev(default)
|-- feature/myfeature *
In the team what if 2 users are working on the same feature. So that they'll have to use the same branch(Not a good practice though). Let's take our 2 users as USER1 and USER2. Suppose that the USER1 and USER2 have already cloned the repo into the local machine.
git clone <ulr here>
Now both the users are working on the project. They have to stick with few guidelines in order to prevent from conflicts.
1. Whenever they have completed something, commit locally but do not push to the feature/myfeature branch.
2. When ever they want to push the code to the branch follow the steps given below.
- git add --all
- git commit -m "your changes"
- git pull
- After pulling, there can be conflicts in the local code. You have to correct them manually and then
- git commit -m "new changes"
- and finally
- git push -u origin feature/myfeature
- if you get an error message, then repeat steps 3 to 7 again.
No comments:
Post a Comment