- Git add
- Add files/folders:
git add file/folder name
- Add all files change:
git add .
- Reset files/folders
git reset file/folder
- Reset all files change
git reset .
- Git commit
- Commit:
git commit -m "[Isuse ID] Message"
- Edit commit:
git commit --amend -m "[Isuse ID] Message"
- Reset commit:
- Last commit:
git reset --soft HEAD~
- Commit id:
git reset --hard <COMMIT -ID>
- Last commit:
- Git push
git push origin <branch name>
- Branch
- Delete:
- Local:
git branch -D <branch name>
- Multiple branches:
- `git branch -D branch-name-1 branch-name-2 ...
- Branch name start with
origin/feature/
:git branch | grep 'origin\/feature\/*' | xargs git branch -d
- Remote:
git push origin :<branch name>
- Local:
- Install
sudo apt-get install git-flow
- Config
cd your-folder
git flow init
Note: Enter all if you don't need modifier
- Branch
- Create branch
git flow feature start branch-name (create base on develop)
git flow hotfix start branch-name (create base on master)
- Finish up a feature (branch)
- Merges MYFEATURE into 'develop'
- Removes the feature branch
- Switches back to 'develop' branch
git flow feature finish branch-name
Note: See about Branch
for more details