0

I am working on a website, and I need to use Git for practical reasons. However, I think I have not totally understood how it works.

I want to do something quite simple, and I am working on localhost. I make several changes, and sometimes I use Git for put the new or modify files on the server.

Edit²: after reading some docs, I have reinit all my git repositories. I really understand nothing to git. So, I connect to my server, and I commit the files. After I reinit my local repository. I add my remote and I did git pull carpe master (carpe is my alias for the remote server). If I do git checkout master on local, I see all the paths from the tracked files from the server. But git did not download the files to the working tree... I really do not understand. What should I do for getting the file in my local working tree ?

vekah
  • 980
  • 3
  • 13
  • 31

3 Answers3

2

By pushing, you've sent your commits to the remote git repository at ssh://user@myname.my/mypath/.git. However, the content of this repository is independent to what your Web server is serving -- the HTML you see in your browser (this is known as the working copy). What you need to do now is to pull the changes from the repository into the server's working copy (git pull origin).

It's really worth putting in the time to go through a decent git tutorial, as others have suggested. My personal favorite is http://gitimmersion.com/.

mpenkov
  • 21,621
  • 10
  • 84
  • 126
1

You have just pushed your changes from the local master branch to the remote master branch. (ie sent your changes to the remote server.)

Have a look here for a descent introduction to git

Tom Squires
  • 8,848
  • 12
  • 46
  • 72
  • So I have read the doc. I feel me more lost than before ... So I have removed all my back git configuration. I init git on the server. I commit. Then I created a remot on local and i pulled him. But the files are still not writing. I mean i have done `git pull carpe master` It should put all my files at the same versions than the master branch on the remote server ? But files arent downloading and git answers me : `already up to date` ... – vekah Jan 31 '13 at 16:40
  • If I do `git checkout master` I see all the file who come from the internet remote. But I see only their path, et they are not written into the working tree. How can I ask to git to check and download file from master branch to working tree ? – vekah Jan 31 '13 at 16:59
  • There are two repositories, yours and the remote. When you do a pull you take all the changes from the remote and apply them to yours. When you do a push you send your changes to the remote server. Checkout master just makes your local repo use the master branch – Tom Squires Jan 31 '13 at 17:26
0

This may help: https://stackoverflow.com/a/9204499/631619

I think the key things to know are:

tracking branches & 'origin'. Understanding this is key. It's the inbetween part of how changes flow to and from remote servers and local environments.

Community
  • 1
  • 1
Michael Durrant
  • 93,410
  • 97
  • 333
  • 497