Category Archives: Tutorials

Every thing you need to know to master git, Part 4, git merge, git diff with GUI tools


Before following this post, make sure you have already set up everything from my other post regarding the configuration of git environment.


Diff command will allow you to compare two different commits, let’s set up a repository:

Now in the second repository, we make some changes:

now let’s back to the first repository and see the changes:

now you should see all the difference in meld:

Merge and conflict

now let’s merge all the changes. If you make some changes on dii=fferent files you will do fast-forward. That means you only incorporate new changes and everything is ok afterward. But if you made some changes on the same file in same lines then you have a merge conflict and you should do a three-way merge.

To show you the point lets make some changes in the first repository in the file A.txt.

now if you call git merge, you will get a merge conflict, to solve this call the following:

and you will get this in meld:

and this in kdiff:

|                MERGED               |

LOCAL: Your side of the conflict – ie, your branch (HEAD) that will contain the results of the merge
REMOTE: The remote side of the conflict – the branch you are merging into HEAD.
BASE: The common ancestor of both local and remote. useful for feeding into a three-way merge tool
MERGED: The result of the automatic merge.

go through the conflict and choose the side (A, B or C) and see the merged file in the window below and save and close.

Everything you need to know to master git, Part 3 (git checkout and git clean)

Cleaning up git environment and rollbacking local changes

Once you started working on your local copy you might mess everything and need to clean up or roll back changes for some file, you can use git checkout and git clean

to rollback changes for a particular file:

to rollback changes for the entire local copy while keeping added files:


if you just want to remove the file and directories that have been added but not staged:

Remove untracked directories in addition to untracked files.

Don’t actually remove anything, just show what would be done.

Show what would be done and clean files interactively. See “Interactive mode” for details.

Everything you need to know to master git, Part 2, git revert, reset amend

How to undo a commit in Git when no one has pulled your changes from the repository? git reset

git reset will do this job for you, it has two option, hard and soft,

git reset –hard/ –soft <SOME-COMMIT>

1)Hard: this option will reset the index and working tree. Any changes to tracked files in the working tree since <commit> are discarded.

2)Soft: this option will leave the unstaged files in the working tree.


A Complete setup


some important note:

git add -A is equivalent to

Let’s continue our work:


The git reflog command records a chronological history of everything you have done in your local repository. Its full output might look like this:

C.txt and D.txt will remain (soft)

C.txt and D.txt will be deleted.

To see which files have been added and status:

Finally lets’ push changes by:


How to undo a push in Git when someone might have pulled your changes from the repository? git revert

If you’ve already pushed your changes and someone else pulled in those changes, you should not use git reset to undo changes, use git revert instead.


Let’s follow our work:


How to edit the git comment? git commit –amend -m “updated”

This will fix your most recent commit message



Pushing into the wrong branch

A very practical situation for the above command is pushing into the wrong branch,

Everything you need to know to master git, Part 1, setting up git environment, GUI, mergetool, difftool

Installing prerequisite

Configuring Git Environment

First config your environment and set a proper merge/ diff tool.  The settings are in /home/<username>/.gitconfig

All these setting can be set or viewed via terminal, i.e

To view current settings:

To set them

All available options for setting a merge tools can be listed by:

here we config it for meld, kdiff3 and vim.


Add the following to your .gitconfig file



User name, Email and editor


Adding Alias


SSH key

and upload your public key


into your GitHub account

Human detection and Pose Estimation with Deep Learning for Sport Analysis

Pose estimation and tracking human is one the key step in sports analysis. Here is in this work I used openpose for analysis of player in a Bundesliga game HSV Hamburg vs Bayer München. Warning: the video might be disturbing for HSV fans 🙂


Original Video

Analyzed Video

Original Video

Analyzed Video

Original Video

Analyzed Video

Original Video

Analyzed Video

Vaganova_Ballet_Academy from Behnam Asadi on Vimeo.


Original Video

Analyzed Video



Thiem_Zverev from Behnam Asadi on Vimeo.

Deep Dreams with Caffe on Ubuntu 16.04

First, install caffe as being explained in my other post here.

Googlenet Model

Download the bvlc_googlenet.caffemodel from

and put it in


IPython, scipy, Jupyter, protobuf, scikit-image

Always install in the user space with –user

Running  jupyter notebook

open  a new notebook and paste the following into it and correct the “model_path” and

img = np.float32(‘/home/behnam/Downloads/fractal.jpg’)) according to your setup.


Installing NVIDIA DIGIST Ubuntu 16.04


Protobuf 3


Install caffe as being explained in my other post here.




# Install repo packages

Building DIGITS

Open in the browser:


Installing Caffe on Ubuntu 16.04

CUDA Toolkit 9.1

visit and download the correct deb file then:

Basic Linear Algebra Subprograms (BLAS)

Protocol Buffers

or you can install protobuf v3  it from source:

Lightning Memory-Mapped Database







Breadth-first search (BFS) and Depth-first search (DSF) Algorithm in Python

BFS traverse:

DFS traverse: