in reply to Using perl to script an upload page

G'day Aldebaran,

[OT: my response only addresses GitLab and git commands — there's no Perl components.]

I use GitLab extensively for $work. I regularly use dozens of repos. I do all my work from the command line. I'm aware that a number of git UIs exist; perhaps other monks can tell you about those.

Git has a lot of commands and they take many options and arguments. I'd recommend that you bookmark "Git - Reference"; use this while reading the following and for future work.

For the following, assume I've collected all cloned repos in a 'gitdir/' directory. I've used 'git.example.com' for the base URL. The project and repo are called (unimaginatively) 'project' and 'repo', respectively.

When starting a new project, the first thing to do is clone the repository (which you indicated that you've already created).

$ cd gitdir $ git clone https://git.example.com/project/repo.git

You can now perform a verification and, what I always do, avoid having to continually retype my username.

$ cd gitdir/repo $ git remote -v origin https://git.example.com/project/repo.git (fetch) origin https://git.example.com/project/repo.git (push) $ git remote set-url origin https://username@git.example.com/project/r +epo.git $ git remote -v origin https://username@git.example.com/project/repo.git (fetch) origin https://username@git.example.com/project/repo.git (push)

You can now begin to add, modify or delete files under "gitdir/repo/". I recommend you use the status command often; it'll mostly tell you what you need to do next. When you do this, your current directory should be "gitdir/repo/", or one of its subdirectories.

$ git status

Common commands you'll use at this point are:

$ git add ... $ git commit ... $ git push

Following a push command, your changes should now be visible via the GitLab web interface.

Those commands probably cover 90% or more of what you'll generally need. You may also want to create branches and tag releases; very briefly:

# Create a branch $ git branch branch_name # Create a branch and switch to it $ git switch -c branch_name # Switch to an existing branch $ git switch branch_name # Publish a new branch (now appears in GitLab UI) $ git push -u origin branch_name # Tag a release (as "v1.000") $ git tag -a 'v1.000' -m '...' # Publish a new tag (now appears in GitLab UI) $ git push origin 'v1.000'

There's a lot more to git but I think this pretty much covers the basics. Revisit the reference documentation for more.

— Ken