Let me sketch out what I'm trying to do. I'm not sure if I can use git for
this or not. I think I can but I'm getting headaches going through the
documentation and experimenting. It's all a bit confusing to me.
I run a minecraft game server and associated client on my machine and a
friends machine who's computer-illiterate. I'm quite actively maintaining
this server by updating the various mods and configuration files that go
with it. These files also have to end up on the clients. On my own machine
I can simply copy it over, rename and delete the files. But it would be
really nice if I can do this on my friends pc as well. That he starts the
game, it checks for updates/changes, downloads and overwrites the existing
files. Doing the renames, deletes and updates for me.
The client however also keeps it's own files among the same files that the
server files end up with. These need to stay the way they are on the client
and cannot be touched. They can be different among clients and contain
personal settings.
The server also has files which shouldn't end up with the clients as
they're server-only.
So to do this, I made a git enabled folder on my machine (using git init)
in which I have just the files that I manage and nothing else. In the same
directory structure as they need to end up on the client and server.
When I make changes, I change them in that directory and run a batch script
(it's all on windows), to commit the changes to the local repository and I
use push to copy them over to another directory as well which is being
served by my webserver.
In the htdocs folder of my apache server I made a DragonCraftRepo
subdirectory and ran git init --bare
I then go back to the folder where I make my changes and do a:
git remote add origin C:/Apache24/htdocs/DragonCraftRepo
The batch file I run after I've done an update is as follows.
(sorry for the date/time localization stuff in there, but it's the only way
I can get a timestamp from the localized windows date/time)
@echo off
> cd Repository
> setlocal enabledelayedexpansion
> for /f "tokens=1-7 delims=.:/- " %%a in ("%date% %time%") do (
> if "%%b"=="Jan" set MM=01
> if "%%b"=="Feb" set MM=02
> if "%%b"=="Mar" set MM=03
> if "%%b"=="Apr" set MM=04
> if "%%b"=="May" set MM=05
> if "%%b"=="Jun" set MM=06
> if "%%b"=="Jul" set MM=07
> if "%%b"=="Aug" set MM=08
> if "%%b"=="Sep" set MM=09
> if "%%b"=="Oct" set MM=10
> if "%%b"=="Nov" set MM=11
> if "%%b"=="Dec" set MM=12
> set HH=0%%d
> set HH=!HH:~-2!
> set YEAR=20%%c
> set MONTH=!MM!
> set DAY=%%a
> set HOUR=!HH!
> git add -A
> git commit -a --quiet --no-edit -m "Update !YEAR!!MONTH!!DAY!!HOUR!"
> git push origin master
> )
> endlocal
So far so good, at least I think so. I don't know half of what I'm doing. I
don't even know if those flags I add to the git commands are the right ones
to use for what I want to do. I think they are after experimenting. But I'm
still a bit in doubt about it all.
Then the next part, setting it up so that those files and changes get
updated with the client.
This is where I really get stuck.
First of all, I don't know if I should pull, checkout, clone, fetch or
merge. The trouble is getting the files I pull out to end up in the same
directory the batch file is running from because it wants to make a
subdirectory to check out into. And then the other problem is that there
already existing files which need to stay there and stay untouched. Git
refused to do this at first so after searching all over I found the
solution:
So I go into the client's directory and then:
git init
git remote add origin http://example.com/DragonCraftRepo
git fetch
git checkout -t origin/master
And that worked fine the first time.
It doesn't run a second time.
It did merge the repository's files with the existing files.
Ok, so I think That's it, now it's working. I just need to pull to get the
updates from here on
git pull
Yes, all seems fine.
I make updates in my main working directory, change some of my filenames,
add a little bit here and there, see how things work out
Run the update creating batch. Yes, nice. It sees the changes and pushed
them to the local repository and to the webserver's folder.
Back to the client directory, see if they come over like I intend to, so I
can stick it in the batch file that starts the client.
git pull
And it says I'm already up to date.
I check, none of my changes made it. Not the filename changes, not the new
files, nor any changes I made inside the old files. None, nada.
And that's where I'm at now. I tried a lot of things I didn't mention here
but for someone whose never touched git before and is clicking around in
windows, this all is starting to get a bit too much and at 5am I really
should go to bed.
Maybe the new day will shed some light on it all, or perhaps one of the
heroes of this group could help out a little bit.
Please?
--
You received this message because you are subscribed to the Google Groups "Git
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.