having a branch for live and development using git on server

So im fairly new to git and have been using if for a java project i am working on. I also manage the development of a website and want to start using git for that. It seems like there should be a way to do this, but I am not completely sure if it is possible. Anyways, here is what I’m hoping.

  1. have a live (branch?) repo that i can push to that stores what is live on the website
  2. have a production (branch?) repo that i can push to to view a staged version of the site. This will be contained in a subdirectory of the root of the server.

I read an article on how to make a git server.. but is what i have outlined above possible? I think it would make my life easier rather than having to remember which files i changed to FTP onto my server.

  • Git push to cPanel account - Push did not update modified file
  • How to overwrite several multi-level(different hierarchy) files from a local version to an online version via FTP
  • Git-ftp add sharp symbol (#) to folders & files names in the root dir of repo
  • set a ftp repository with git
  • Does GIT support push to an ftp server?
  • Git hosting using an FTP-accessible web server?
  • Thanks

  • How to push to remote after a git rebase?
  • Change Git Repository Of Existing Xcode Project
  • Files without extensions in .gitattributes
  • Configure Git to use Plink
  • How to reset to my last commit in Android Studio
  • Capistrano deploy from Git HTTP repo
  • 2 Solutions collect form web for “having a branch for live and development using git on server”

    Note that any git repo you are pushing to on a server should be a bare repo (that way, there is no synchronization issue between what you are pushing and the working tree, since a bare repo has no working tree).

    You usually push (the branch you want) to the bare repo, and you have a post-receive hook which will checkout the content of that branch to (one of your) web site directory, depending on the branch you have just pushed.

    See “how to process files on a branch in post-receive hook in git” as a concrete example.

    What your thinking of is having a master branch and a development branch. In general, anything that is pushed to the master branch by convention means that your application should be using that code. When you’re pushing to a development branch the code should be small fixes and improvements for your application. Later on these small fixes can be merged into your master branch so your application will be using it.

    Git Baby is a git and github fan, let's start git clone.