Display graph of all commits.
git log --graph --all --oneline
Create a new git instance
git init
Stage files
git add README.md
Commit files
git commit -m "first commit"
Adding remotes
git remote add origin git@github.com:pedramphp/git-best-practices.git
Pushing to a remotes
git push -u origin master
rebase: add all commits on the feature branch to the end of master branch Note: it always needs to happen locally on your feature branch. Common in open source projects, easier to read.
git checkout feature-branch
git rebase master
Interactive rebasing.
git rebase -i BRANCH_NAME
git rebase -i COMMIT_HASH
you can do the following
- edit commit messages
- squash
- remove commit
- reorder commits.