-
How to initialize git
git init
-
How to send to the staging area
git add <file_name>
- How to use it cleverly:
use git status to check before you commit
git add <file 1> <file 2>
git commit -m "msg that express something both files have in common"
- How to use it cleverly:
use git status to check before you commit
-
How to commit a change to creat my 1st snapshot
git commit -m "MEANINFUL MESSSAGE"
P.s.: Meaninful msg: Why, How, Limitations, Effects
-
How to check in what conceptual areas my files are
git status
P.s.: Uncommited, Unstaged, Untracked files
-
Hot to get the history:
git log
git log -n <no>
git log --abbrev-commit
git log ---help
-
How to compare versions of the same file:
git diff <commit ID> <commit ID>
git show <commit ID> <commit ID>
git show -2 <file name>
(to check the last 2 versions of a file)
-
How to create and use a link between local and remote repository
-
Create a link ('bridge')
git remote add <name4link> <ssh>
obs.: name4 link is usually the same name as my repositories, but can be anything I like. It is just a name for the link that is being created.
-
Send things from local to your remote repository
git push
-
-
How to bring changes from the remote to the local reposiory:
git pull
obs.: examples of whento use - when your local is not sync with the remote. If i`m collaborating or if i change something directly in the remote.
-
Banchs
Creating:
git branch <name new branch>
Moving inside the new branch:
git checkout <name new branch>
Checking for new branchs I need to pull:
git fetch