Posts Tagged ‘version control’


Checkout subdirectory in a git repository

In howto on Jul 13, 2016 by theoryl Tagged: , , ,

To checkout a subdirectory in a Git repository using sparse-checkout, follow these instructions

git remote add -f origin
git config core.sparsecheckout true
echo /path/to/subdirectory >> .git/info/sparse-checkout
git checkout master


git clone
cd whatever
git config core.sparsecheckout true
echo /path/to/subdirectory >> .git/info/sparse-checkout
git read-tree -mu HEAD

Also see this StackOverflow answer.



How to sync a forked git repository?

In howto on Jul 13, 2016 by theoryl Tagged: , , ,

To synchronize your forked Git repository with the upstream, follow these nice instructions on StackOverflow:

# Add the remote, call it "upstream":

git remote add upstream

# Fetch all the branches of that remote into remote-tracking branches,
# such as upstream/master:

git fetch upstream

# Make sure that you're on your master branch:

git checkout master

# Rewrite your master branch so that any commits of yours that
# aren't already in upstream/master are replayed on top of that
# other branch:

git rebase upstream/master

# If you don't want to rewrite the history of your master branch,
# then you should replace the last command with the following

#git merge upstream/master

# Now push your branch to your own forked repository

git push origin master

# If you've rebased your branch onto upstream/master you may need to
# force the push in order to push it to your own forked repository

#git push -f origin master


Bazaar & Loggerhead on Ubuntu 10.04

In howto on May 22, 2010 by theoryl Tagged: , , , , , , , ,

A quick installation log of Bazaar 2.1.1 and Loggerhead 1.17 on Ubuntu Lucid Lynx 10.04. Bazaar is a tool for distributed Version Control System (VCS), which some also call it Source Code Management (SCM). Loggerhead is a web-based code browser for Bazaar repository (more info)

1. Install from Ubuntu repository:
$ sudo apt-get install bzr loggerhead

2. Setup Bazaar as you would or refer to their decent 5-minute tutorial

3. The documentation of Loggerhead does not exist online, but is found in /usr/share/doc/loggerhead. All that you need to do though is:
$ sudo cp /usr/share/doc/loggerhead/examples/serve-branches.conf.example /etc/serve-branches.conf
$ serve-branches /path/to/branch
(by default, the host is localhost, the port is 8080. If these are not your choice, simply include the arguments --host=USER_HOST --port=USER_PORT. Optionally you can set --prefix=USER_PREFIX too)

4. Now you should be able to browse your codes at http://localhost:port/ (or http://USER_HOST:USER_PORT/USER_PREFIX/ if you set these arguments earlier)

5. To hide branches from being displayed, add to ~/.bazaar/locations.conf under the branch’s section:
http_serve = False

Read More »