a) If you use https credentials:
git clone https://github.com/clarkepeterf/git-pro.git
b) If you use ssh credentials:
git clone git@github.com:clarkepeterf/git-pro.git
c) You can also name a repository something different if you like:
git clone git@github.com:clarkepeterf/git-pro.git todays-presentation
Edit a set of changes that you or a peer worked on previously:
git checkout feature-branch-1
Make sure you have the latest updates on this branch. If you checked it out previously, you may have a local copy that is further behind the remote branch.
git pull
View the current status of your repository:
git status
At this point it should say "nothing to commit, working tree clean"
A file tracked by git can be in one of 3 states:
- Modified - the file has been changed, but those changes have not been stored in the repository. Modified files show up as red 馃敶 in
git status - Staged - the file has been changed and is marked to be committed. Staged files show up as green 馃煝 in
git status - Committed - the changes have been stored in the repository. Committed files no longer show up in
git status
Files can also be:
- Untracked - a file not previously added and committed to the repository. Untracked files show up separately and are also red 馃敶 in
git status - Ignored - add a file to .gitignore to ensure git does not track it - used for things like .env, *.pem, other personal or secret-containing files
- Edit src/hello.js so that it says
hello("$YOUR_NAME")instead ofhello("World")and save the file - Execute
git statusin your terminal - hello.js should show as modified in git's output
- Create a file called new.js
- Execute
git statusin your terminal - new.js should show as an untracked file in git's output
- Follow examples a and b above
- Execute
git add src/hello.jsin your terminal - Execute
git statusin your terminal - Now hello.js should be staged and new.js should still be untracked in git's output
- Execute
git commit -m "adding my name to hello.js"in your terminal - Execuite
git statusin your terminal - Now hello.js no longer shows up in git's output. Its changes have been committed and stored in the repository. new.js is still untracked - it can be tracked later with another
git addandgit commit
You can view commit history with:
git log
This will show output like:
To exit the git log pager, type q
You can share your changes back to the remote branch with
git push
This allows your teammates to see your changes and add on to your work.
Here are official documentation links to the git commands discussed in this section:

