#Git Workflow 1:
- Create a project folder. This folder will contain all the files and folders for your repo
- From a Mac or Linux terminal: Navigate to the path where you'd like to create the folder. Then type
mkdir <folder_name>
, replacing<folder_name>
with whatever you'd like to name your folder.
You can also accomplish this from Finder or Windows Explorer.
-
Initialize a Local Repository.
- From terminal navigate inside the folder you just created. Use
cd <path_to_folder>
, replacing<path_to_folder>
with the path to the folder you just made. If you are unsure, or have spaces or special characters in your folder names, use tab completion to make sure you use the correct path and names. - Type
git init
. If you have done this correctly you should see a message that saysInitialized empty Git repository in...
- From terminal navigate inside the folder you just created. Use
-
Create a Remote Repository.
- Go to Github.com. Sign in if you need to.
- Click the
+
button and selectNew Repository
. - Give your repo a name, and initialize it as you see fit. Then click
Create Repository
.
- Link Local and Remote repositories.
- In your terminal navigate to the folder where you have initialized a git repository.
- Type
git remote add origin <address_of_repo>
, replacing<address_of_repo>
with the HTTPS link on your new remote repo Github page.
-/-
(Repeat as many times as you need to)
- Add files. Build out files as you would normal do. Use
git status
to check in on what changes you've made. Then when you feel you've made the changes you would like to make typegit add <file_name>
, replacing<file_name>
with the name of the file you'd like to add. If you want to add all the new and changed files you can typegit add .
. - Commit changes. Once you've added all the files you'd like to add, commit your changes and add a commit message. Type
git commit -m "<message>"
, replacing<message>
with a description of what changes you are making, in the active, present tense. - Pull from remote repo. Ensure that you have all changes that have occurred on the remote codebase by pulling. Type
git pull origin master
. - Push to remote repo. Push all the changes you have just commited to the remote codebase. Type
git push origin master
.