-
Notifications
You must be signed in to change notification settings - Fork 1
Git
Andres Olarte edited this page Oct 26, 2017
·
7 revisions
git commit --amend
git push origin my_branch --force
If the commit that is amended has already been pushed, then --force
is needed when pushing.
Create branch and checkout
git checkout -b my_branch origin/master
Checkout file from a different branch
git checkout master -- my.file
git remote add upstream https://github.com/remote/remote.git
git fetch upstream
git merge upstream/master
git push origin master
Merge from master
into feature1
git checkout feature1
git merge master
- Fetch recent version
git fetch origin
- Rebase
git rebase origin/master
- Resolve conflicts
- Mark conflicts resolved
git add .
- Continue the rebase
git rebase --continue
- Push to origin
git push origin my_branch --force
Show remotes
git remote -v
Change remotes
git remote set-url origin https://github.com/USERNAME/OTHERREPOSITORY.git
Revert the last commit
git reset HEAD~
To squash interactively
git rebase -i HEAD~3
Where 3 is the number of most recent revisions that will be up for squashing
Init the submodule
git submodule update --init --recursive
git remote add upstream https://github.com/remote/remote.git
git fetch upstream
git rebase upstream/master