I am trying to set up a repository on a server that will be used to develop, modify and run programs. I have come up with a workflow of how to do this but I am confused as how it will work when multiple users are making modifications at the same time. Here is what I have:
I have 2 directories - "/home/me/code_repository/" and "/home/me/code_development/"
My programs are in code_repository - so "/home/me/code_repository/programs" which is where my .git file is, and therefore my repository.
I cloned this into "/home/me/code_development" using:
cd /home/me/code_development/programs
git clone -l -s home/me/code_repository
Now when I want to develop my programs cd into "home/me/code_development/programs", make a new branch, modify my program and push it to "home/me/code_repository" like so:
git branch me_dev
git checkout me_dev
**modifications**
**testing**
git add .
git commit -m "modified program1"
git push origin me_dev
Now I have 2 branches in my origin repository - "home/me/code_repository" and I can review the changes and merge them together, and delete my branch me_dev:
git diff master me_dev
git checkout master
git merge me_dev
git branch -d me_dev
Now I go back into "/home/me/code_development/programs" and I merge my me_dev branch into master and delete me_dev:
git checkout master
git merge me_dev
git branch -d me_dev
now my code_repository master branch and code_development master branch are the same, with the modifications made. As another level of test so that I do not lose anything when I cd into "/home/me/code_development/programs" I can do a git pull.
git pull /home/me/code_repository/programs
If there are multiple users developing code on their own specific branches when in "/home/me/code_development/programs", and push to "/home/me/code_repository", if there are changes to the same file/same lines - how do i resolve this? Is it a case of reviewing which changes I would actually want then merging, and resolving the merge conflict? Also is this a good way to set up a multiple user git repository and development/test suite?
Aucun commentaire:
Enregistrer un commentaire