On 04/10/2016 08:48 AM, Adam S wrote:
> Hi all,
> 
> I'm new to git and really confused.

Hi Sebastian,

as an average computer user that cannot code (my background isn’t
technical, but in humanities), I can assure you that learning git is easy.

Just in case you wonder, I use git for my texts or other projects (such
as http://www.from-pandoc-to-context.tk).

> I will be working on a collaborative project and so will need to use it.
> 
> So far I've learnt how to intsall git and create a local repository, but
> thats it. Anything else I do seems to not work and I get the message:
> 
>     repository '/Desktop/git-test/' does not exist
> 
> even though I can "ls -la" the contents of the directory.

I assume that you are working on Linux.

Your error message states that '/Desktop/git-test/' isn’t the same as
'Desktop/git-test'. The first path is absolute, the second one is
relative to your actual directory.

But including tyour commands will help the rest of us to suggest better
methods.

> What now?
> 
> I need to learn how to:
> 
>   * Branch
>   * Commit
>   * Merge
>   * Tell git which files to commit and which not to
>   * Hook in to a remote server (can I use GitHub to test on?)

I guess the order should be different. Add files, then commit changes,
then deal with remotes, then branch and then merge.

I will explain the first three ones. My approach isn’t technical, so it
may turn out to be too simplistic for you in the near future.

Adding files is pretty simple:

  git add README.txt

You may use wildcards, although I recommend that you use them only if
you know exactly which files are you including.

Symlinks aren’t followed, but stored as files.

With "git add" you track the file(s) for commit. The repository is given
information about the file, but it isn’t included.

Before commiting, you have to identify yourself (tell git who you are).
Name and email are required:

  git config user.name "John Doe"
  git config user.email john...@example.com

This would set the identification for that git repository. If you want a
global configuration:

  git config --global user.name "John Doe"
  git config --global user.email john...@example.com

BTW, I personally prefer to use as email address the one displayed by
GitHub (if enabled): usern...@noreply.github.com. This protects your
privacy and you are identified (as GitHub user).

To commit changes is also simple:

  git commit -m "this is the commit description"

Files should be added first to be commited.

If you want to add a multiline commit description, you may use:

  git commit

And a new editor will be opened, where you have to type the commit
description. Even with multiple lines, it is wise to keep the
description clear, short and simple.

I personally prefer to invoke for commits:

  git commit -p

Which doesn’t include the whole file (as per default), but the diff
between both files.

Of course, you may use GitHub for your tests. Remember all projects are
public with the open source version (https://github.com/open-source).

If you’d rather have private projects, Gitlab and Bitbucket may be
interesting to you.

The way of adding your commits to a remote server would be:

  git remote add origin https://u...@github.com/repository.git
  git push origin master

Of course, you should have to add a project at your GitHub account
first. Gitlab or Bitbucket work also fine with the required changes in
the previous command.

So, that’s it. It would help a lot to read https://progit.org/. Although
I only understood it partially (I’m not a developer), I must say it was
an excellent book.

I hope it helps,

Pablo
-- 
http://www.ousia.tk

-- 
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 git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to