Git allows and encourages you to have multiple local branches, entirely independent of each other. You can do:
Git is smaller and faster than SVN(another version control tool).
Git Clone
Ensure the cruptographic integrity of every bit of your code! with commit id, you can be sure that nothing in its history was changed.
Staging before commit
1. add to staging area
2. commit to repository
Collection of git alias - Jihyo personal!
graph = log --graph --branches --tags --remotes --oneline --decorate --pretty=format:'%C(auto)%h%C(auto)%d %Creset%s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
gone = "!f() { git fetch --all --prune; git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D; }; f"
undo = reset HEAD~1 --mixed
: Alias for showing the graph of branches on console
: Alias for removing local branches that are gone on remote
git fetch --all --prune
just fetches remotes infogit branch -vv
list branches and pipes output lines to awkawk '/: gone]/{print $1}'
find lines with gone
, select first column (which is branch name) and pipe to xargsxargs git branch -D
takes received branches names and deletes them: Alias for reseting the previous commit on this branch, and check out all the previous committed changes as uncommitted
: Changing the most recent commit BUT need to force push
usecases
- add changes to last commit without editing its message
$ git add .
$ git commit --amend --no-edit
- edit commit message
`$ git commit --amend`
or
`$ git commit --amend -m "new commit message"`
: Removing files from tracking
$ git rm -r --cached filepath