git memo
hacking on a topic branch
Create a topic branch:
$ git branch try/parser
Switch to the topic branch:
$ git checkout try/parser
Merge changes from master, pretending it occurred before the topic branch:
$ git rebase master
Switch back to the master:
$ git checkout master
Merge changes from a try branch in a single commit (if you want):
$ git merge --squash try/parser
(note this will cause conflict for all changes in the future if you try to merge in normal fashion.)
Force delete a try branch:
$ git branch -D try/parser
hacking without forking on github
$ git clone git://github.com/n8han/Unfiltered.git
$ cd Unfiltered
# hack
$ git commit ...
The local files stay local until you push them, so commit all you want. Without the push privilege, you won't be able to push into the remote (origin) anyway.
To grab the latest as if you haven't hacked it yet,
$ git pull --rebase
If you want to submit your local patch to the upstream, only then hit the "fork" button.
Next, add the fork as a remote repository:
$ git remote add fork git@github.com:YOUR_USERNAME/Unfiltered.git
At this point .git/config looks as follows:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = http://github.com/n8han/Unfiltered.git
[branch "master"]
remote = origin
merge = refs/heads/master
[remote "fork"]
url = git@github.com:eed3si9n/Unfiltered.git
fetch = +refs/heads/*:refs/remotes/fork/*Edit the aliases for the remote repositories as follows:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
[remote "upstream"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = http://github.com/n8han/Unfiltered.git
[branch "master"]
remote = origin
merge = refs/heads/master
[remote "origin"]
url = git@github.com:eed3si9n/Unfiltered.git
fetch = +refs/heads/*:refs/remotes/fork/*Now, origin points to your repository.
$ git push
- Login to post comments
