-
Notifications
You must be signed in to change notification settings - Fork 406
Git Workflow
git clone git://github.com/edubart/otclient.gitRemember to always update your fork before making a pull request. Make sure that you have the remote upstream, if you does not have it yet, create now.
git remote add upstream git://github.com/edubart/otclient.git
git fetch upstreamMake sure that you are pulling from upstream with rebase if you pretend to make pull requests on the upstream.
git pull --rebase upstream master # pull new upstream changes to your local repository
git push -f # this may overwrite your forkgit stash # save any changes
git fetch # update remote repository information
git reset --hard origin/master # reset your local ranch making identical to the remote master
git stash pop # restore changesThis is just like the instructions above, but with a different remote.
git stash # save any changes
git fetch # update remote repository information
git reset --hard upstream/master # reset your local ranch making identical to the remote master
git stash pop # restore changesgit add file # add new files
git commit -a # commit all modified files
git pull --rebase # update your local repository before pushing
git push # push your changes to the masterIf you commited anything wrong and didn't push yet, instead of doing another commit to fix, you can redo the previous commit.
git commit -a --amend # append new changes to the latest commitYou can use stash for storing changes in a temporarly without needing to store then on a new branch.
git stashTo restore just pop latest stash.
git stash popUse with care, rebase will rewrite the commit history, so make sure that you didn't pushed the commits that you are joining yet.
git rebase -i HEAD~2 # will enter in interactive rebase in the latest 2 commitsNow in the interactive rebase, mark the commits that you want to join with "squash", in rebase you can also delete commits, change commits order, commit messages and more. If anything goes wrong use git rebase --abort to cancel.
There are many tools that can be used to check current changes and commit history, in the web you can also find graphical good tools, the next ones generially comes with git, and I usually get what I want with gitk.
git status
git diff
gitkCreate new branch 'tmp' based on the current branch and change to it.
git checkout -b tmpChange to branch master.
git checkout masterMerge commits from branch tmp into the current branch.
git merge tmp