0

I have cloned my live site repo locally so that I can view and work on my site fully. Now I've done a bunch of changes, tested my site, and committed them. What do I need to do to reflect just the committed changes back to my live site?

I've read about push and merge but could only get as far as knowing that merge is related to branches/forks and that my case is not that. I've cloned the repo.

  • It would all depend on how your site is hosted. Does it actually run off your Git repo? Or do you publish it in some way? – codemonkey Jun 09 '14 at 14:53
  • It's not on github or bitbucket. Git is installed on my hosting provider's servers. The repo is where my site lives. –  Jun 09 '14 at 14:55
  • How did you publish the live site the first time? – codemonkey Jun 09 '14 at 14:57
  • ftp, but lately I've done everything the git way as in, turned it into a repo, added a .gitignore, then git add, then commit. It's only after that when I've cloned it locally. –  Jun 09 '14 at 15:05

1 Answers1

1

Using git push origin <branch> is exactly what you want to do to push your changes back to the origin (the URL you cloned your local repository from). For example if you are working on the branch master(verify this by typing git branch) you can use the command git push origin master.

The name origin is the default name for the repository you cloned from but can be changed. See .git/config inside your repository for other potentially registered remotes you can pull from and push to.

stefanglase
  • 10,296
  • 4
  • 32
  • 42
  • using `git branch` locally gave me `* master` –  Jun 09 '14 at 15:00
  • Using `git push origin master` gave me `! [remote rejected] master -> master (branch is currently checked out)` –  Jun 09 '14 at 15:09
  • In this case the answer is a bit longer but already answered on StackOverflow: http://stackoverflow.com/questions/2816369/git-push-error-remote-rejected-master-master-branch-is-currently-checked – stefanglase Jun 09 '14 at 15:20
  • I've almost done everything in that article. Where it says "Then delete all the files except .git in that folder", not sure how to do that, I know `rm -rf` this would delete everything but I don't know how throw in an exception. `rm -rf !(.git/)` didn't work. I could easily do that using ftp, but I want to use the command line. –  Jun 09 '14 at 16:50