Get Going with Git
June 5, 2017
git markdown tutorial howtoGetting set up in Terminal
Determine present working directory with pwd
pwd
If necessary use cd to change your working directory
cd /Users/Name/Documents/Git Folder
Initialize, Add, Commit and Push
Initialize the local directory as a Git repository as follows:
git init
add the files in local repository. This stages them for commit
git add .
Commit the files that have been staged in the local repository.
git commit -m "First commit (or other comment)"
Commit changed/updated file(s)
Add the changed file, e.g. data.csv, to the staging area
git add data.csv
What does staging a file mean? The file is in a staging area, i.e. set aside, in preparation for a commit.
You can check to see that this has occured by using status
git status
statuscan also tell you what files have been recently updated even before staging (or so I think).
Commit changes using commit (no suprises there). The comments here should be helpful with version control.
git commit -m "some sort of comment"
Easiest workflow after making a change is to check the status. If changes are present, they can be staged with add. Check to make sure the changes have been staged using status. Changes can then be pushed once staged and commited.
git init
git add .
git status
git commit - m "changes from TODAYS_DATE"
git push
Push repo onto GitHub
Copy-paste your Git repository URL from GitHub
In Terminal, use the following code to add the URL for where the local repository will be pushed
git remote add origin GITHUB_REPOSITORY_URL
Verify the URL
git remote -v
Push changes in local repository to GitHub
git push origin master
Much of this was obtained from Netlify’s tutorial.