Archive for the 'software' Category

Git Fast Forward

>git branch -a

* development

mylocal-branch

origin/development

>git status

# On branch development
nothing to commit (working directory clean)
>git merge mylocal-branch (you want to merge from mylocal-branch to development branch )

> git push <repository | origin> development

Works if the remote branch ‘development’ has no simultaneous commits from a co-worker, say.

But fails with the following messages if there were simultaneous commits on the remote branch ‘development’

! [rejected]        development -> development (non-fast forward)
error: failed to push some refs to ‘<your repository name>’

Here is how to fix this scenario,

> git pull <repository | origin> +development:development

The ‘+’ option fast forwards the local ‘development’ branch to the remote ‘development’ branch

> git merge mylocal-branch

At this point you have changes from the remote and local ‘development’ branches merged

> git push <repository | origin> development

The changes were now pushed to the repository without being rejected. This is one scenario where you can use fast forward to merge changes and bring local and remote branches upto date.

Some useful and common regular expressions (regex)

Regex for URI

 var uri_re = /^(?:(?:[^:\/?#]+):)?(?:\/\/(?:[^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/;

If sudo apt-get install gitweb fails

I hope this is useful to someone. I was trying to set up git and gitweb.

>sudo apt-get install git-core

was successful but gitweb was not,

>sudo apt-get install gitweb
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package gitweb is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package gitweb has no installation candidate

If you get this error message,

Try sudo apt-get update

and then run

sudo apt-get install gitweb

This installed gitweb successfully.