# for github, you can use curl!# replace 'your github username' with your username# replace 'your repository name' with the name you'd like to call your repository# keep EVERYTHING ELSE as is
curl -u 'your github username' https://api.github.com/user/repos -d '{"name":"your repository name"}'
How do you link your local and remote repository? →
# replace "your username" and "the url to your repository" appropriately # (keep the @ symbol... it means... your user, at that web site)
git remote add origin https://github.com/your github user name/your_repository.git
Summary for Setting Up and Linking Remote and Local Repositories
What’s the typical workflow for changing and saving your files using version control? →
make changes
git diff –color (show your changes)
git status (to see the status of your changes)
git add –all (to stage your changes for committing)
git status (to see your staged changes)
git commit -m ‘my message’ (to save your changes)
git log –color (show your changes so far)
git push origin master (optionally send/share your changes to a remote repository)
git status
What does git status do? →
git status - show what changes are ready to be committed as well as changes that you are working on in your working directory that haven’t been staged yet
git add
What does git add do? →
# it marks a file or files as ready to be saved# add all
git add --all
# add specific file
git add myfile.txt
git commit
What does git commit do? →
# git commit takes a snapshot of your work# (it saves it!)# in the directory of your repository# don't forget the commit message
git commit -m "commit message goes here"
git log
What does git log do?
# git log shows you the commit history of your repository or file
git log
# you can also colorize the output:
git log --color
git diff
What does git diff do? →
# it shows the line-by-line differences between your last commit and your working directory# use --color for syntax highlighting
git diff --color
Summary for Working With Files
# make changes# look at the differences between your last save and your current changes
git diff --color
# check on the status of your changes
git status
# "stage" or mark your changes as ready to be saved
git add --all
# check the status again to see that you changes are ready to be saved
git status
# save!
git commit -m "my message"# show a log of your changes so far
git log --color (show your changes so far)# send to a remote repository (to submit an assignment)
git push origin master
All git commands must be run in your repository directory (where you ran git init)