Great and simple resource:
https://www.git-tower.com/learn/git/ebook/en/command-line/introduction#start
also:
https://www.smashingmagazine.com/2015/07/development-to-deployment-workflow/
similar examples as above:
https://www.digitalocean.com/community/tutorials/how-to-use-git-effectively
**How To Set Up Automatic Deployment with Git with a VPS
https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps
further example of using Hooks in Git
How To Use Git Hooks To Automate Development and Deployment Tasks
https://www.digitalocean.com/community/tutorials/how-to-use-git-hooks-to-automate-development-and-deployment-tasks
How To Set Up a Private Git Server on a VPS
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-private-git-server-on-a-vps
If using Vagrant, after using command ‘vagrant up':
1. At the command line, give Git your name using the following command:
$ git config --global user.name "YOUR NAME"
Use the next command to give Git your email address. If you are going to use a hosted repository, use the email address here that you will use to sign up.
$ git config --global user.email "YOUR EMAIL ADDRESS"
You can see all of your settings with this command:
$ git config --list
2. Change into the project's root folder on the command line and use the “git init” command to start versioning this project:
$ cd path/to/project/folder
$ git init
A new, hidden folder was added named “.git”. All that happened is that Git created an empty local repository for us. Git did not add the current content of your working copy (working directory) as something like an “initial version”. The repository contains not a single version of your project, yet.
Working Copy
The root folder of your project is often called the “working copy” (or “working directory”). It's the directory on your local computer that contains your project's files. You can always ask the version control system to populate your working copy with any version of your project. But you always only have one working copy with one specific version on your disk – not multiple in parallel.
3. Create an empty file in your favorite editor and save it as “.gitignore” in your project's root folder. add a line for each file that you would like git to ignore.
For WordPress projects, below is an example of my default ‘.gitignore' settings. The ‘updraft' folder is for the ‘UpdraftPlus' plugin.
*.log
wp-config.php
wp-content/advanced-cache.php
wp-content/backup-db/
wp-content/backups/
wp-content/blogs.dir/
wp-content/cache/
wp-content/upgrade/
wp-content/uploads/
wp-content/wp-cache-config.php
wp-content/updraft/
/.htaccess
/license.txt
/readme.html
The list of files to ignore is kept in a simple file called “.gitignore” in the root folder of your project. It's highly recommended to define this list at the very beginning of your project – before making your first commit. Because once files are committed, you'll have to jump through some hoops to get them out of version control, again.
Which Files Should I Ignore?
As a simple rule of thumb you'll most likely want to ignore files that were created automatically (as a “by-product”): temporary files, logs, cache files… Other examples for excluded files range from compiled sources to files that contain passwords or personal configurations. Templates can be viewed here https://github.com/github/gitignore
Ignore one specific file: Provide the full path to the file, seen from the root folder of your project.
path/to/file.ext
Ignore all files with a certain name (anywhere in the project): Just write down the file's name, without giving a path.
filename.ext
Ignore all files of a certain type (anywhere in the project):
*.ext
Ignore all files in a certain folder:
path/to/folder/*
4.We add our files and then commit the files:
$ git add -A
$ git commit -m "Initial commit"
The comment in quotes after -m is a message describing the commit.
note: You may see a warning after the ‘git add -A” command like:
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF...
You canignore this and/or turn this warning off by typing on the command line:
git config core.autocrlf true