OK, I just want to check the workflow of my GIT setup is correct and I understand it fully before I begin to use it properly. I'm following this workflow and this topic is just going to start with the initialization and creating feature branches then when I'm confident with that I'll create a new topic for Releases and Hotfixes. Hopefully this will help other people to who are looking to use GIT in a similar workflow.
There are 3 developers, let's call them A, B and C who will all work on their local machine, we have 4 remote servers - 'Development', 'Staging', 'Production' and Unfuddle (as the centralized server). Developer A has the directory of files on their local machine.
So, i'm thinking the workflow will be as follows.
Firstly, I need to create the repository on Unfuddle and locally then push my files to the Unfuddle server.
- Create a repository in Unfuddle called 'website' and give it the abbreviation 'web'
- Create an SSH Keypair on 'Development', 'Staging' and 'Production' servers and add them to Unfuddle account.
Developer A initializes a Git repository in their document root:
git init
Associate the Unfuddle repository with developer A's local one and designate it as an upstream server:
git remote add unfuddle git@subdomain.unfuddle.com:username/web.git
git config remote.unfuddle.push refs/heads/master:refs/heads/master
Developer A adds all files to index
git add *
Developer A commits all files
git commit -am 'initial commit'
Developer A pushes locally made commits to Unfuddle Git repository.
git push unfuddle master
I should now see all of my files within my Unfuddle repository. Developers B and C may now clone the repository to get a copy of the website files.
`git clone git@subdomain.unfuddle.com:username/web.git`
Feature Branches:
Each developer can now begin creating feature branches using the following workflow:
git checkout -b develop
git checkout -b feature\test develop
- Make any code changes
git commit -a -m "Make test code changes"
git checkout develop
git merge --no-ff feature\test
git branch -d feature\test
git push unfuddle develop
OK so the next part I'm unsure of. We have pushed the feature changes to the centralized Unfuddle server, however the other developers need to get the changes, therefore would they need to create a 'develop' branch and then do git pull unfuddle develop
? I've read a fetch and merge is better than pull, is this the case? If so, would it be git fetch unfuddle develop
then git merge develop
?