Git - Part 1
Git it done!
This post gets the gist of git
Tracked, Untracked and more
- On your local repository, files are either tracked or untracked and tracked files could be one of unmodified, modified or staged.
~ Pro Git book
Explains:
- When you
git initorgit clonea repo, everything is unmodified because git automatically tracks all the files inside the local repo. - You then make changes to some files. Those become modified.
- You add these files to the staging area with
git add. They become staged. - Finally when you’re happy with the changes, you
git committhe files are then unmodified again. - When you add the files to
.gitignore, they are not tracked anymore or in other words untracked.
Branching
- a branch is a pointer to a commit
HEADis a pointer to the local branch you’re on
HEAD pointing to a branch ~ Pro Git book
Rebase
Rebase branch A onto branch B is replaying all commits only belong to A onto B
The end commit introduced by rebase a branch onto another and the one by a merge is the same
Do not rebase commits that exist outside your repository and people may have based work on them. ~ Pro Git book
The last one roughly translates to:
Only rebase for local testing or before
git pushto make clean commits.