Intro Commands
Version
git --version
List existing configurations
git config --list
Set configurations
git config --global user.name "Bashar Ghadanfar" git config --global user.email "10.tens@gmail.com"
Create folder
mkdir Treehouse
Move files to folder
mv *.py Treehouse
Enter new folder and list files
cd Treehouse ls
Hosting a Project on GitHub
Initialize repository inside a directory
git init
View status of new or changed files in your directory
git status
Add one file in the directory to track
git add filename
Add multiple files in the directory to track
git add .
Commit added files along with a message
git commit -m "initial commit"
Link the local project to the online GitHub repository, using a remote name of “origin”
git remote add origin https://github.com/lionbytes/Treehouse.git
Push our local master branch up to the online origin repository
git push origin master
Add, Commit & Push
Frequently repeated steps to push up projects will be:
- View files status.
- Add file(s) to track.
- Commit files with a message.
- Push branch up to remote repo.