1

I recently inherited a project that was setup to use Git and bitbucket.org and I need some clarification on how the workflow moves. My setup is as follows:

  • my Drupal site is stored on Bitbucket.
  • I also have a XAMPP installed on my Mac to test locally and my production site is on a Linux box.
  • I guess I have three repos: Bitbucket, locally and on the production server.

When I git clone my project to my local machine it saves the files to a Projects folder at /Users/myaccount/Projects. My XAMPP installation is at /Applications/XAMPP/htdocs/devsite. So, I have to move the files from Projects into XAMPP to run the Drupal site.

Does that mean when I make changes to the local files found in XAMPP and I am happy with all the changes I want to update both of my other repos? Do I have to move my files back to the Project folder before staging them? Or should I set up where my local files are cloned to?

What's the relationship of the git repository in Project and the files in my XAMPP installation?

1 Answer 1

1

When you git clone a repo, you're automatically setting up a link between the remote repo and your cloned repo that allows you to git pull and git push changes back and forth from your master branch to the remote master branch.

Ideally, you would set things up so that your XAMPP document root pointed to your source files. That way, you would be able to edit the files and immediately test the results. Having to copy files back and forth is a really bad setup, that inevitably will lead to you making a mistake that introduces untested/buggy code into the repo, or worse, loses changes.

Likewise promoting to production could be as simple as doing a git pull.

Typical work flow I use:

-Start new topic branch (git checkout -b foo)
-Edit source, test changes.
- git status (verify new files, updated files) - git add -u (add all the changed files) - git add /new/specific file (I do this for any new files I want to add to the
- git commit -m "Commit message" - git checkout master (checkout master branch) - git pull (were there any new changes from the team?) - git merge foo (Merge my new changes from my topic branch to my master branch) - git push (pushes changes from my master branch to the remote master branch)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .