Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A basic git question #42

Open
FHulot opened this issue Feb 12, 2017 · 6 comments
Open

A basic git question #42

FHulot opened this issue Feb 12, 2017 · 6 comments
Labels

Comments

@FHulot
Copy link

FHulot commented Feb 12, 2017

Hope this question is okay here. I am woefully ignorant of git. I have looked at various git intros and have not found a solution to this problem, but admit that I might not recognize the answer if I saw it. Maybe this question can pass as a "documentation issue"? Eventually people as ignorant as I am will want to use SyncOrg. Well, I guess that's already happened.

So far, in my org directory on the server on my LAN I have done

git init

git add *.org

git commit *.org

After the first sync by SyncOrg all the org files appeared on my phone. That was good!

After making changes on the phone and syncing again, though, the org files on the server did not change.

SyncOrg seems to be doing its part, though. Each time I modify and sync, I get three new subdirectories in .git/objects.

Using

git cat-file -p

I do see the changes I made on the phone. So the information is making it to the server. This is also good!

So I must be missing something. A command I should issue on the server to combine the modifications in .git/objects with the main files, maybe? Hoping it's that simple.

Thanks in advance. Alternatively sorry in advance for posting this in an inappropriate place.

FH

@colonelpanic8
Copy link

Hope this question is okay here. I am woefully ignorant of git. I have looked at various git intros and have not found a solution to this problem, but admit that I might not recognize the answer if I saw it. Maybe this question can pass as a "documentation issue"? Eventually people as ignorant as I am will want to use SyncOrg. Well, I guess that's already happened.

So far, in my org directory on the server on my LAN I have done

Wait are you saying that you are hosting your own git server? Or are you merely accessing the git repository using ssh?

git init

git add *.org

git commit *.org

After the first sync by SyncOrg all the org files appeared on my phone. That was good!

After making changes on the phone and syncing again, though, the org files on the server did not change.

git is a distributed version control system (see https://en.wikipedia.org/wiki/Distributed_version_control), so adding new commits ONLY makes changes locally.

I'm going to make a wild guess here, but what I'm guessing is happening is that you are using some service (github, bitbucket etc) to host your git repository, and expecting to see changes on your computer (which you initially created the repository with) whenver your phone syncs. This won't happen because you need to sync your computers repository with the remote (github, bitbucket etc).

SyncOrg seems to be doing its part, though. Each time I modify and sync, I get three new subdirectories in .git/objects.

Using

git cat-file -p

I do see the changes I made on the phone. So the information is making it to the server. This is also good!

Ahh, perhaps what you mean is that your working tree is not getting modified,

So I must be missing something. A command I should issue on the server to combine the modifications in .git/objects with the main files, maybe? Hoping it's that simple.

You probably just need to checkout the appropriate sha/branch.

Thanks in advance. Alternatively sorry in advance for posting this in an inappropriate place.

FH

@FHulot
Copy link
Author

FHulot commented Feb 12, 2017

Thanks for your quick reply to my question.

Wait are you saying that you are hosting your own git server? Or are you merely accessing the git repository using ssh?

Well, both I think. The SSH connection is between my phone and a server on my LAN, where I created the repo.

I have my emacs org-mode files in a folder on a file server on the LAN in my home. I think the commands I ran (see above) created a git repo. Now I want to use SyncOrg to freely modify the files either on my phone or on the server from a computer in my house, and have the files up-to-date both places, which I understand is the purpose of SyncOrg.

I think I'm on the right track because it wasn't until I created this git repo that SyncOrg successfully copied the org files to my phone.

You probably just need to checkout the appropriate sha/branch.

Oh boy you see my problem is I sort of want to learn what that is, but I would also be happy to know I just have to run a particular command to add those changes to the org-files proper.

So far, SyncOrg is adding folders to .git/objects which reflect the changes I made on the phone, but the files in my org folder aren't changing. Does this mean SyncOrg has created a new branch? What do I need to do to combine those changes to the org-files proper?

I realize I'm being pretty lazy here and totally understand that RTFM is a reasonable reply to my question.

Thanks again
FH

@colonelpanic8
Copy link

So basically what is happening is that the repo is getting updated but your index (sort of like what revision/version of your repository that is currently active) and the associated working tree (the actual state of the staged files) aren't being changed because git servers don't really work that way. In fact, usually there is no working tree/index on the git server if it IS only a server. In your case, you want the server's working tree to get updated whenever the Sha that the master branch is pointing at is changed.

I can think of two ways to do this -- probably the best way to do it would be to use a git push hook. I might try looking on stack overflow for push hook to update HEAD (or index/working tree). You could also run a cron job to update the working tree every minute.

I probably used a bunch of terms that you might not be familiar with -- you don't need to understand all of them, but if you feel confused you might want to google them.

@FHulot
Copy link
Author

FHulot commented Feb 13, 2017

Thanks again for the help. You helped me realize I really understood nothing and needed to learn. I read some of the manual on git-scm.com and got SyncOrg working finally. Soon will post what I did for any other git-ignorant folks like me who wander this way.

@wizmer
Copy link
Owner

wizmer commented Feb 22, 2017

Thanks to @IvanMalison for the reply.
@FHulot, if you really feel motivated you could modify the wiki and add a "Git newbie corner" section to it with what you learned. That would be awesome.

@FHulot
Copy link
Author

FHulot commented Feb 22, 2017

@wizmer Thank you I will. Am working on it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants