I’ve prepared a cheap tutorial for newbies.
Git Simple Guide is so far the best git guide I’ve seen. Go, check it out.
Don’t waste your time here.
There is nothing useful here.
Well, looks like you are still here…
Start configuring git then, assuming you have already installed it.
git config --global user.name "..." git config --global user.email "firstname.lastname@example.org"
Open a dummy folder and start git bash to try it out. Create dummy files, add them, try the syntax. Check what’s going on by “git status”.
- First you need to initialize git.
- Check status when you are bored.
This will show you changes, e.g. deleted, renamed, modified files and the environment for those changes, working environment and staging environment.
Modify a file and check the status again.
Add a file
git add filename.ofcyouneedtotypetheextensionhaveyounoteverusedcommandlinebefore
- Check the status again
You’ll see the modified file is colored green, that’s because you moved the changes from Working Directory to the Staging Area by using
git add. Congratulations!
Files in staging area will be committed when you run
- Add all changes to the staging area
Use dot to add all changes in the current working directory instead of one specific file.
git add .
ofc, not in the whole repo. please leave this blog now, if you don’t know what dot means.
yes, leave. no one wants you here.
- Commit the changes
git commit -m "type-something-short-and-meaningful.please."
- See the commits you made
wanna see something cooler?
git log --all --decorate --oneline --graph
You can also add by file type. Check the example is below and notice the quotes.
git add '*.txt'
The quotes mean, look for whole working directory including sub-directories. Without the quotes git will not look for the files in sub-directories.
You can also add more than one file by using the syntax below.
git add file0 file1 file2
To all files (including sub-directories), all commands below are equivalent.
git add . git add -A git add *