On Tue, 2016-01-05, Christian Gollwitzer wrote:
> Am 05.01.16 um 13:08 schrieb Alf P. Steinbach:
>> A bit off-topic, but, since clc++ never had a charter I feel safe, ;-)
>>
>> Sure enough, after committing it listed like 30 new changes, which I
>> then had to commit again.
>>
>> And after that, a single remaining change that I had to commit.
>>
>> Surely it's not meant to work like that, incremental commits?
>>
>> I haven't used Git earlier so it's all new to me, including that I
>> haven't the foggiest idea what the difference is between committing and
>> pushing changes (sync) to GitHub.
>
> Are you talking about some GUI from GitHub? I've only ever used pure git
> from the commandline, where it works like this
>
> 1) git commit -a
> This opens up an editor with an overview of the changes, you enter a
> description to cimmit your changes. These are then stored locally only
> (in the .git folder)
Note that that's just one of many ways of producing commits.
> 2) git push
> send all commits to the server (github, in that case), i.e. publish them.
Well ...
The more general form is 'git push <remote> <my_commit>:<your_branch>',
so 'git push github master:master' means:
"Dear github, please take your "master" branch and make it so
that its tip becomes my commit called "master". You may steal
as many commits from me as you need. And if you refuse because
doing it would mean something more disruptive than just adding a
string of commits on top of your present "master", that's ok
too; I'll survive (and perhaps add a --force next time)."
> If you have new files, you need to "git add" them, to be included in the
> commit. If you leave off the "-a" from the commit, it only includes
> changes in the files which you explicitly "added" to the commit. The -a
> adds all files that are already under version control.
>
> "git pull" is the opposite of "push" and it updates your local copy with
> the changes from the server. As opposed to a centralized VCS like CVS or
> SVN, you do not need to push everything to the server - you can happily
> commit to your local repo, and once you think it is working as desired,
And once you see it's split into commits in a nice and logical way.
You can do pretty much anything to the commits as long as they're unpublished,
using e.g. rebase -i.
> you "push" it to the server. The more professional users like the kernel
> developers also perform a rebase operation, which allows you to bundle
> several commits into one before you publish the changes. Personally, I
> do not do this, I publish every typo correction.
YMMV, but that's one of the best things about Git. You don't have to
be professional to appreciate that -- just perhaps a bit more
interested in the history than the average person.