Git directory Installation
git init: This sets up the git environment. Go to a directory you want git installed. You only do this once.
git config –global user.name “YOUR_USERNAME”: Add your name here, source
git config –global user.email “email@example.com”: Add email here
Commonly used Commands
git status: The most commonly used command. It will tell you the files that have changed but not added, added files, and recommend you do a commit
git branch: Shows you all your branches
Git Document Workflow
Getting and Updating your Project
git clone: Initially you will need to do a git clone to get your project, but you only need to do this once, unless you delete your project.
git pull origin master: After your initial clone, use this to update your project from the server.
- git branch
: You make a branch of your work. This is a copy. You make changes to the copy and not the master. This way the changes can be undone in an orderly manner.
- Edit your documents.
- git add
/ : Add these files to your staging area. You can add the whole directory, just ensure you have an ending “/”
- git commit -m “Some Comment”: Commit all changes to files in the staging area. The comment will remind you of the changes, which you will see when received by the server
- git push origin
: Push your branch’s staging area up to the server
- On the server, do a merge request, followed by the approval for the merge
git rm ‘*.txt’: removes files
git branch -d
git push origin
When git runs it sends you emails, so you know it has completed.