Sat, 17 Nov 2012

Git cheatsheet


Keywords: git

Merge newer changes on the branch you came from (eg master):

$ git rebase master


Merge your branch:

$ git merge [--no-ff] newbranch


Push a newly created branch upstream:

$ git push -u origin newbranch

-u makes your branch a tracking branch of upstream

.


Create a new tracking branch:

$ git branch -t newbranch origin/newbranch


Delete remote-tracking branch:

$ git branch -r -d origin/oldbranch


Delete remote branch: (see also http://git-scm.com/book/ch3-5.html)

$ git push origin --delete oldbranch


Rewrite history:

$ git rebase -i HEAD~5


Make a branch retroactively (see http://blogs.perl.org/users/mark_leighton_fisher/2012/11/when-to-create-a-branch-in-git.html):

$ git checkout -b newbranch
$ git update-ref refs/heads/master origin/master


Merge a branch that should have been rebased:

$ git fetch https://github.com/user/repo.git upstream_branch:local_newbranch
$ git checkout local_newbranch
$ git rebase master
$ git checkout master
$ git merge -ff-only local_newbranch
$ git branch -d local_newbranch


Create a branch for a pull request:

$ git pull https://github.com/user/repo.git upstream_branch:local_newbranch


Move a branch to a new commit:

$ git branch -f branch_name new_tip_commit


Look at a file from an previous revision:

$ git cat-file -p <sha1>:filename

[/revision_control] permanent link

Fri, 27 Jan 2012

Ubuntu and Notion


Keywords: linux ubuntu notion

I use Notion as my window manager under Ubuntu. Notion is a fork of Ion.

Under Ubuntu 11.10 you can set Notion as your default window manager by creating the file /usr/share/xsessions/notion.desktop with the contents:

[Desktop Entry]
Encoding=UTF-8
Name=Notion
Comment=This session logs you into Notion
Exec=notion
Icon=
Type=Application

Then edit /etc/lightdm/lightdm.conf:

user-session=notion

and if you want to automatically login set:

autologin-user=XXX

where XXX is your username.

[/unix] permanent link




November 2022
Sun Mon Tue Wed Thu Fri Sat