Grow your CSS skills. Land your dream job.

Branching with Tower Gitclient

  • # February 22, 2013 at 6:10 am

    Hey Guys,

    I’ve been using Tower for a while for version control and to work locally and deploy a largish project that I run. I have it set up with Beanstalk and everything works great.

    I’m at the stage where I want to rework a section of the site and I know its going to take a while and that there will be other maintenance that will need to be done during that time, so it seems to me the perfect place to create a branch.

    But that’s where I am stuck… All the documentation says just right – click and add a new local branch… Great… but how do I work with the actual files.

    Do I create a local duplicate copy of the site and commit that to the branch. Do I work on the same version of the site and just do the commits differently? But then what if I need an existing and a new version of the same file to be functional.

    Can anyone point me in the right direction? I kind of understand how to make it work and commit it… but don’t understand how to organise it on my machine.

    Thanks a lot.

    # February 22, 2013 at 7:31 am

    When you check out a branch, that site’s folder becomes that branch, so you only have one branch worth of files at any one time. So basically, nothing about your workflow changes, except that you know you’re on a different branch. Make sense?

    Also, I would highly recommend taking the time to learn how to use Git from the command line.

    # February 22, 2013 at 7:38 am

    @mtedwards – It took me a little while to grasp as well, but basically it just uses the existing files, so once you’re using a new branch the files just belong to that. You can switch to another branch at any time and the files will change to the last commit of that branch.

    You don’t have seperate files/folders for each branch, Git will do all that for you when switching branches.

    # February 22, 2013 at 9:44 am

    Thanks for your help guys, but in still missing something. I think I must have it wrong conceptually in my head.

    But using a real example… I’m working locally on a wordpress site and I want to revamp the file single-jobs.php in a separate branch.

    If I start editing that file and commit to it a new branch what do I do if I need to make an edit to the existing one?

    Or do I commit changes the separate branch and the if I need the old files I switch branches and pull that down?

    # February 22, 2013 at 9:33 pm

    You seem to have got it in your last paragraph.

    # February 22, 2013 at 9:50 pm

    Ah. Great. I think typing it out made me realise the way it would work.

    Thanks a lot for your help guys.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".