Using Git
Some very basic git commands. I don't use it a lot so don't always remember the commands I need.
Initialise a repository
Often I want to set up a main repository on my server that I can share amongst my other machines - so I can work on the laptop or the desktop machine (when James will let me use it). To do this you need to set up a bare repostitory.
git init --bare <repostitory name>
eg:
[don@@server moko-papa.co.nz] git init --bare theme/moko-papa/
Initialized empty Git repository in /srv/git/moko-papa.co.nz/theme/moko-papa/
[don@server moko-papa.co.nz]$ ll theme/moko-papa/
branches/ config description HEAD hooks/ info/
objects/ refs/
On the client, we need to clone the repository before we add to it.
don@client:~/Development/moko-papa.co.nz/user/themes$ git clone don@server:/srv/git/moko-papa.co.nz/theme/moko-papa moko-papa
Cloning into 'moko-papa'...
warning: You appear to have cloned an empty repository.
Now we can add files to the folder, and add them to the git repository.
don@client:~/Development/moko-papa.co.nz/user/themes $
don@client:~/Development/moko-papa.co.nz/user/themes$ cp -a moko-papa.bak/* moko-papa/
don@client:~/Development/moko-papa.co.nz/user/themes$ cd moko-papa/
don@client:~/Development/moko-papa.co.nz/user/themes/moko-papa$ git add *
don@client:~/Development/moko-papa.co.nz/user/themes/moko-papa$ git commit -m "Inital commit of existing files"
<snip>
create mode 100644 templates/partials/social.html.twig
create mode 100644 templates/partials/taxonomylist.html.twig
create mode 100644 templates/simplesearch_results.html.twig
create mode 100644 templates/snipcart.html.twig
create mode 100644 thumbnail.jpg
don@client:~/Development/moko-papa.co.nz/user/themes/moko-papa$ git push
Enumerating objects: 1993, done.
Counting objects: 100% (1993/1993), done.
Delta compression using up to 4 threads
Compressing objects: 100% (1984/1984), done.
Writing objects: 100% (1993/1993), 4.68 MiB | 6.40 MiB/s, done.
Total 1993 (delta 208), reused 0 (delta 0), pack-reused 0
To server:/srv/git/moko-papa.co.nz/theme/moko-papa
* [new branch] master -> master
don@client:~/Development/moko-papa.co.nz/user/themes/moko-papa$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
don@client:~/Development/moko-papa.co.nz/user/themes/moko-papa$
Now it is set up.
git add
git commit
On the server
git pull