Page 29 of 37

Re: My Adventure Game Engine - GIT is hard. Need help please

Posted: Mon Aug 02, 2010 8:27 am
by Robin
Something which might be useful:

Code: Select all

git commit -a
This takes all changes and puts them in the commit you make (except new files, it won't add any new files unless you tell Git to).

I use it so often, I have a two-character alias for it.

Re: My Adventure Game Engine - GIT is hard. Need help please

Posted: Mon Aug 02, 2010 9:45 am
by kikito
I used to do that, until I realized that it adds changed files to the commit, but not new files. As a result, I had this tendency to forgetting adding new files. So I stopped using git commit -a.

Re: My Adventure Game Engine - GIT is hard. Need help please

Posted: Mon Aug 02, 2010 7:00 pm
by Jasoco
Why is there no automatic sync that uploads both changed files and new files without having to remember which files you added or changed? Who designed that thing? Was it the early 21st century because technology has advanced so far, GIT is so far behind! WTF?

And if I try "git commit -a" it takes me into VIM and asks me to enter a message. But won't tell me how the fuck to actually send the message! F*** I HATE VIM! GOD DAMN WHAT A S***TY PROGRAM!

Did I mention I HATE VIM? I DON'T KNOW THE F***ING KEY COMMANDS TO SEND THE F***ING MESSAGE F***ING HELL!!

Why do I have to do it manually? This is 2010. It should be automatic single command, single button push of all changed, new and moved files without any user interaction. This is why I didn't want to use GIT.

Edit: Pardon my anger. The bank screwed up my check deposit and I am worried they won't fix it. Also, I saw a girl wearing a "Team Cullen" T-shirt. So you can understand I'm a little irritable.

Re: My Adventure Game Engine - GIT is hard. Need help please

Posted: Mon Aug 02, 2010 7:39 pm
by nevon
Jasoco wrote:Why is there no automatic sync that uploads both changed files and new files without having to remember which files you added or changed? Who designed that thing?
git add *
Well, that adds adds them to your next commit. After that, just git commit -m "message" && git push.
Jasoco wrote:Was it the early 21st century because technology has advanced so far, GIT is so far behind! WTF?

And if I try "git commit -a" it takes me into VIM and asks me to enter a message. But won't tell me how the fuck to actually send the message! F*** I HATE VIM! GOD DAMN WHAT A S***TY PROGRAM!

Did I mention I HATE VIM? I DON'T KNOW THE F***ING KEY COMMANDS TO SEND THE F***ING MESSAGE F***ING HELL!!
Dude, chill! Git is awesome. I'd dare say you won't find many professional and/or knowledgeable software developers that don't think version control systems are awesome. If you want a pretty GUI, there are plenty to choose from - and they're all just a google search away.
Jasoco wrote:Why do I have to do it manually? This is 2010. It should be automatic single command, single button push of all changed, new and moved files without any user interaction.
There is. You just didn't know it already (despite me actually mentioning it in my first step-by-step). There's a learning curve to everything. Git is crazy easy to use once you've gotten used to it (which shouldn't take more than a few days).
Jasoco wrote:Also, I saw a girl wearing a "Team Cullen" T-shirt.
Oh! Then it's all perfectly understandable.

Re: My Adventure Game Engine - GIT is hard. Need help please

Posted: Mon Aug 02, 2010 8:12 pm
by Jasoco
Is it safe to add all files every time? Won't that upload all 5MB of it each time? Even though 4.99999MB hasn't been changed yet?

Edit: Seemingly not. So, how would I go about making a shell script that will CD to the project directory, add *, commit changes while prompting me for a password, then update the files?

Re: My Adventure Game Engine - GIT is hard. Need help please

Posted: Mon Aug 02, 2010 8:34 pm
by thelinx
When adding files, it actually adds the changes.

When committing, it stores those changes as a checkpoint.

Please, check out http://gitref.org. It's for your own good.

Re: My Adventure Game Engine - GIT is hard. Need help please

Posted: Mon Aug 02, 2010 9:07 pm
by nevon
Jasoco wrote:Is it safe to add all files every time? Won't that upload all 5MB of it each time? Even though 4.99999MB hasn't been changed yet?

Edit: Seemingly not. So, how would I go about making a shell script that will CD to the project directory, add *, commit changes while prompting me for a password, then update the files?
Like thelinx suggests, read the Git Reference. It will explain things a million times better than I could. In short, add * only adds the stuff that has been changed; and it doesn't upload anything (push uploads).

As for a shell script, I guess:

Code: Select all

#!/usr/bin/env bash
cd ~/project-directory
git add *
git commit -m $@
git push origin master
Usage would be: ./shellscript.sh Commit message here.

I haven't tested it though, so I have no idea if it would actually work. You should really just learn the commands and do it manually - either using the command line or using a GUI. There's only like 4 commands that you'll be using often anyway.

Re: My Adventure Game Engine - GIT is hard. Need help please

Posted: Mon Aug 02, 2010 9:16 pm
by Robin
You can change the editor. With the environment variable $GIT_EDITOR, for example. Or $EDITOR, which would change the editor used for pretty much any CLI script or program that needs to invoke an editor. Also, you can use -a and -m together. I think you can set an alias to

Code: Select all

alias com='git commit -am'
so you can type

Code: Select all

com "Added Snakes() to plane.lua"
or whatever you want :3

btw, Git is actually one of the most modern ways to organise your code in existence. Started in 2005, because the makers of BitKeeper were withdrawing the free version, and none of the other systems were good enough for Linus Torvalds. Mercurial has the same back-story, and is very similar to Git in day-to-day use, however underlying philosophy and inner workings are vastly different.

Re: My Adventure Game Engine - GIT is hard. Need help please

Posted: Mon Aug 02, 2010 9:55 pm
by TechnoCat
There are a few reasons why it doesn't automatically upload it every time:
1. Your changes aren't always a good thing.
2. A lot of times repo's are used for group projects. And you can't be forcing everyone to merge non-functioning or partial code with everybody's stuff every time you save a local change.
3. How would you comment your changes if it automatically synced changes? Comments are super useful.

Re: My Adventure Game Engine - GIT is hard. Need help please

Posted: Tue Aug 03, 2010 2:40 am
by Jasoco
This isn't a group project though. Well, not like that other project. And only changes that I want shown will be updated. I don't need automatic as in timed syncs. I just want a simple one-button approach to add, commit and push it all. Can't seem to get the Shell script working though. Keeps saying "Permission Denied".

Code: Select all

#!/usr/bin/env bash
cd ~/Documents/Coding\ Projects/LÖVE/Adventure
git add *
git commit -m $@
git push origin master
What does "origin master" do? I was just using "git push".