Welcome to Catalin(ux) M. BOIE's page!
Here you can find some work of mine on Linux kernel & other stuff.

E-mail: catab # embedromix dot ro
Phone: +40-745-048374
RSS feed for this site
IPv6 Ready
My Fedora repository: rpm -Uhv http://kernel.embedromix.ro/dinorepo-0.0.11-1.noarch.rpm
My Oracle/RedHat/CentOS repository: rpm -Uhv http://kernel.embedromix.ro/dinorepo-el-0.0.12-1.noarch.rpm
Supported architectures: x86_64, i386, armv7hl, aarch64.
For commercial support and customizations, contact us at: Embedromix

[Home]  [Networking]  [Crypto]  [Linux kernel patches]  [Userspace]  [Docs]  [CV/Resume]  [Links

Name Description Links
IFB A mini howto on how to shape on incoming packets and distribute packets on multiple interfaces, sharing bandwidth. ifb.html
RAID mini HOWTO A mini howto describing linear, 0, 1, 5 and 6, using mdadm. RAID.html
git mini HOWTO A mini howto describing how to use git. git.html
LVM mini HOWTO A mini howto describing how to use LVM. LVM.html
IPv6 mini howtos Some mini howtos to easy IPv6 implementation. ipv6.html
Random stuff Some usefull one-liners. random.html

Another mini HOWTO for git


Content: Usage of git subcommands with examples
Author: Catalin(ux) M BOIE
URL: http://kernel.embedromix.ro/docs/ Version: 0.1

[ ] Theory
- index - (alias "staging area") is a virtual place where you preapare for a commit.
- HEAD - ???
- topic branch - ???
- rebasing - ???
- Fast forward - Merge without a need for commit

[ ] Set up a global/local configuration file (~/.gitconfig)
	# Set the name
	git config --global --add user.name "Catalin BOIE"

	# Set the e-mail address
	git config --global --add user.email "user@spamtrap.co"

	# Set the name of the committer
	export GIT_COMMITTER_NAME="Catalin BOIE <user4@spamtrap.co>"

	# Add a reference to a file that contains things to be excluded from add
	git config --global --add core.excludesfile "my_excludes"

	# Set the e-mail for a specific git repository (PROJECT/.git/config)
	git config --add user.email "user2@spamtrap.co"


[ ] Creating a repository
	# Starting without having any code written
	mkdir repo1
	cd repo1
	git init

	# Starting by importing some existing files
	# Adds all files to index file
	gid add -v .


[ ] Adding a file to repository
	echo "hello" > hello.txt
	git status # You can see that hello.txt is untracked now
	git add -v hello.txt
	git status # You can see that hello.txt is ready for commit
	# Now change hello.txt
	git status # You will see that hello.txt is not included for next commit
	git add -v hello.txt
	git status # Now it is ready for next commit


[ ] Find out the differences between index file and current status
	git diff # Show differences between index and working copy
	git diff HEAD # Show differences between HEAD and working copy


[ ] Commiting
	# Commit changes
	git commit -m "Commit message"

	# update modificed files tracked by git and commit changes
	git commit -a -m "Commit message"

	# Merge the changes that are in the index with the last commit
	git commit --amend


[ ] Differences between two trees
	# diff between parent of HEAD and HEAD
	git diff-tree -v -p HEAD


[ ] Show nice log of commits and diffs
	git whatchanged -p
	git whatchanged tag1 tag2


[ ] To see the log
	git log
	git log hello.txt
	# Find the most recent tag reachable from a commit
	git describe <commit>
	# Show if your commits in a branch were integrated or not
	git cherry <branch>
	# Notes next to commit, without altering history
	git notes


[ ] Tagging
	# Tag current HEAD as "v0.0.1"
	git tag v0.0.1


[ ] Branching
	# Get a list of the branches and shows the current branch
	git branch

	# Show branches and the last commit message of every branch
	git branch -v

	# Create a branch (without switching to it)
	git branch branch1

	# Create a branch from current working copy and switch to it
	git checkout -b branch1

	# Creating a branch not using current branch HEAD but a tag (v0.0.1)
	git branch branch2 v0.0.1

	# Go back to master
	git checkout master

	# Remove a branch (it will give an error if is not merged yet)
	git branch -d branch_to_be_del

	# Force remove a branch
	git branch -D branch_to_be_del


[ ] Merging
	# See graphic
	gitk --all

	# Merge branch1 in master
	# Switch to master
	git checkout master
	# Merge
	git merge -m "Merge work from branch1" branch1

	# Merge modifications from master in branch1
	git merge -m "Merge x" master

[ ] Rollback
	# Reset current head to a specific version
	# using a tag
	git reset v0.0.1
	# or, specifying the id
	git reset ce013625030ba8dba906f756967f9e9ca394464a
	# or specifying a parent
	git reset HEAD^
	# or a grand parent
	git reset HEAD~2

	# Undo last commit: let's say that you commited something and you want
	# to undo it because the commit doesn't have all the files or the
	# message is wrong
	git reset --soft HEAD^
	# here you change files/add files/remove files
	git commit -a -c ORIG_HEAD

	# Move last 4 premature commits to a topic branch
	git branch topic1
	git reset --hard HEAD~3
	# Now, only topic1 branch has that commits, master has them removed

	# Permanently remove last commit
	git reset --hard HEAD^


[ ] Reverting
	# Revert a commit
	git revert HEAD

	# Remove a pending stage from index
	git rm --cached _file_


[ ] Housekeeping
	# git gc
	# git prune


[ ] Cloning a repository
	# Cloning prj1 (local filesystem location) into prj1clone
	git clone -l prj1 /path/prj1clone

	# Cloning a remote repository
	git clone git://git.kernel.org/pub/scm/.../linux-2.6 my26


[ ] Get commits from a repository without merging
	git fetch
	# in a local branch
	git fetch git://... branch3


[ ] Get commits from a repository and merge them
	git pull


[ ] Export to patches
	# Export as patch last 4 commits
	git format-patch --signoff HEAD~3..


[ ] Sends patches by e-mail
	git send-email \
		--cc cc1@example.net \
		--cc cc2@example.net \
		--to mainteiner@example.net \
		--envelope-sender @me@example.net \
		--suppress-cc all \
		patch1 patch2 ... patchn


[ ] Apply a series of patches generated by a peer with "git format-patch"
	git am --signoff 1.patch 2.patch 3.patch...


[ ] Export to a tarball
	git archive --format=tar --verbose HEAD | gzip -9 > mytree.tar.gz


[ ] Apply a received patch from a third party
	git apply --verbose patch1.patch


[ ] Core stuff
	[ ] Inspecting a file using the SHA1
		git cat-file -t ce013625030ba8dba906f756967f9e9ca394464a
		git cat-file "blob" ce0136250

	[ ] Check a possible corrupt repository
		git fsck --full


[ ] Setup of a public repository using HTTP
	# Setup a separate git repository containing only .git dir from prj1
	git clone --bare /path/prj1 prj1.git
	# Go to directory's project
	cd prj1.git
	# Prepare hook (???)
	chmod a+x hooks/post-update
	# Update some internal informations
	git update-server-info
	# Edit the name of the repository
	nano description
	# Now you can copy prj1.git to the web server
	# Somebody that wants to clone your repository can do:
	git clone http://yourserver.com/~you/prj1.git
	# To update prj1.git
	cd /path/prj1
	git push -v --all --tags prj1.git

Links:
- User manual: http://www.kernel.org/pub/software/scm/git/docs/user-manual.html
- Tutorial: http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html
- git Subversion transition: http://git.or.cz/course/svn.html
- http://www.openca.info/docs/git-example.html
- Nice Linus Torvalds talk about git: http://www.youtube.com/watch?v=4XpnKHJAok8
- Small howtos: http://www.kernel.org/pub/software/scm/git/docs/howto-index.html
- Nice small howto: http://www.free-bees.co.uk/articles/using_git_locally/
- Free git hosting: https://rocketgit.com/