You can use Git to track the different versions of a file by first adding it so that Git is aware of the file you are interested in, second committing the changes you made. This all happens on your local computer. When you want these changes to be visible on the remote repo you are connected to, you then push it from the local to the remote.
Return to the mysyllabus.md you've made and add some readings or assignments.
Remember to save it!
In your working directory (GitPractice) in the command line, type:
git add mysyllabus.md
This stages the file to be tracked, and prepares it to be committed.
If you have been working on multiple files, git add --all
adds all files if you have many to be tracked.
Type: git commit -m "[add a message here about the commits you're making]"
Be brief but descriptive about changes in this version so that both you and your collaborators know the differences between your versions.
It is good practice to check your status (make sure you're in the working directory) using:
git status
Git will tell you if changes have been made but not "staged" (i.e. not added) or committed.
- git status
- git add
- git commit -m "[message]"
Now, how do you get these changes onto GitHub so that others can see your good work?
Because our local and remote repos are connected, we can push
our local repo to its remote directory.
In the command line, type:
git push origin master
You'll then be prompted to enter your GitHub username and password.
Refresh GitHub in the browser to see your changes.
Glossary ~ ~ ~ Helpful commands