Customer Portal

Get Involved. Join the Conversation.

Topic

    Shiloh Madsen
    Using GIT for version control
    Topic posted April 15, 2011 by Shiloh MadsenBronze Trophy: 5,000+ Points, last edited October 29, 2011 
    1437 Views, 10 Comments
    Title:
    Using GIT for version control
    Content:

    So I have been trying to set up version control, initially with SVN then with GIT to try to stave off some overwriting problems we have been seeing, I followed along with the guide, but I seem to be having some trouble, likely due to me trying to set it up incorrectly. My hope is that the "local" files when referring to local and repository can be the WebDAV directory (specifically the development directory). The problem seems to come in with the fact that both GIT and SVN seem to want to write files to the local directories for them to do their work. I can create the repository on my GIT/SVN on the repository I have set up. I wont talk about the SVN process as I understand GIT is the preferred method for RNT version control. 

    So I use the GIT Bash program and go over to my webdav connection and navigate to the development folder and type git init like it says. It fails at this point because it cannot write to that folder. I assume the need to store files is whats stalling both this and what also stalled me on SVN. 

    Am I doing something wrong with it, or is it necessary for me to copy the directory local and attach GIT to my local copy? If so, that makes the job of keeping sync MUCH more difficult. 

    Comment

     

    • Robert Lund

      I'm not sure we recommend one type of source control over another. I'd say use what works best for you. Personally, I like Git and it seems to fit very well with Customer Portal, but we did use Subversion in the past. Unfortunately, you will have to pull down a local copy of the site in order to use source control like Git (or SVN). This might seem cumbersome at first, but there are a couple things to keep in mind. First, you can actually use Git to help you make sure you remember to push all of your changes up to the server. When you run 'git status' you will have a nice list of every file that has changed locally and you immediately know which ones need to be pushed up to the server via WebDAV. Second, as long as you stick to the rule 'everything must be committed and pushed to your central remote git repo before being pushed to the RightNow server' you will run into far fewer conflicts when working with multiple devs. In my opinion, the benefits the of a full fledged source control system far outweigh the extra cost of downloading the site. It has been a lifesaver on many occasions.

      Oh also a quick recommendation, initialize your repo at the euf/ level. You may be versioning a bunch of files that you have no control over system_assets/, rightnow/, etc. but this will make sure you get the assets/ directory and all of its files as well as development/.

    • Jordan Hoff

      Look into GIT hooks... We have a script setup to automatically upload all changed files via webdav on commit. Our approach involves using a patched version of cadaver ( see this: http://lists.manyfish.co.uk/pipermail/cadaver/2009-August/000468.html ) that allows you to pass a "script" of commands. Basically, the GIT hook will make a list of the files that changed from the last commit, write up a script then pipe that to cadaver, which uploads the files.

    • Robert Lund

      Whoa, that is pretty cool. I'm definitely going to look into using Git hooks, that sounds nice.

    • Nital Joshi

      Hi Robert,

      How you deploy repo committed code to oracle staging server? As of now we copy manually via winScp to all 24 language support instance. I wanted to make this automate through some script or a deployment tool.

       

       

    • Robert Lund

      In general, WinSCP or Cyberduck is what folks are using as a WebDAV client. However, as Jordan mentioned, you could use something like Cadaver (http://www.webdav.org/cadaver/) if you would like to script up your uploads.

    • Rajan Davis

      If you want to use git, I would highly recommend signing up with a BitBucket account; you can get unlimited private repositories for free. If you are not worried about your code being public facing, Github is still nice although you have to pay for private repositories.

      Using the Cyberduck CLI, NPM, cURL, Bash, and Git, I was able to create some automations for backing up source code to a private repository, concatenating and minifying assets, and transferring files between test and production sites. It's not too ridiculous to get something set up if you have some familiarity with the terminal and scripting.

    • Nital Joshi

      So as per Jornden and Rajan with the help of hooks we only replace the changed files to stage and production via script. right?

      Is it a good idea to have a script which copy and replace complete customer folder in stage/production?

      And in deployment script how you replacing prod file? you first creating same folder structure with diff file and then uploading it on prod or you uploading file by file to the prod?

       

    • Rajan Davis
      Nital Joshi said:

      So as per Jornden and Rajan with the help of hooks we only replace the changed files to stage and production via script. right?

      Is it a good idea to have a script which copy and replace complete customer folder in stage/production?

      And in deployment script how you replacing prod file? you first creating same folder structure with diff file and then uploading it on prod or you uploading file by file to the prod?

       

      View original

      From my experience, you can only modify and move around files in the assets and development folders. You can still download and back up the entire codebase including the staging, production, and core files, but you cannot directly edit them from what I can tell.

      You will still need to deploy any changes made to development files into staging and production. The overall difference is that with the ability to back up your code to a repository, you do not have to worry about having accidentally overwritten code or trying to find some really old version of some file from months ago.

       

    • Nital Joshi

      @Rajan: ability to backup to local repository means you taking backup of files that you changed on development server?

      what in my mind is :

      In below picture I want a deployment script that will deploy my code to stage and production for all 24 language hosts.

       

       

    • Rajan Davis

      To the best of my knowledge, no, you cannot automate the staging and promotion deployments.

      What you can do with something like the Cyberduck Command Line Interface is synchronize the development areas across multiple interfaces. So if you update code in one interface, you can have something to detect the changes in this code, back up this code to a git repository, and then synchronize the code across all of the development areas of all of the interfaces.