Showing posts with label git. Show all posts
Showing posts with label git. Show all posts

Monday, December 13, 2010

How can i revert to previous version in git ?

There is git revert HEAD  and here is how i tested on a simple repository
mkdir test
cd test
git init  .
touch to_be_reverted
git add .
git commit -a
echo "Wrong text" > to_be_reverted
check it with

cat to_be_reverted
Wrong text
git commit -a
git revert HEAD
cat to_be_reverted

it should be empty like before

Wednesday, January 07, 2009

merging an fork with the main repository in git

I have fork-ed arora and i had added some very small changes
the problem is to update my repository and merge the changes already done on the main one

I go to my local cloned repository (the forked one is in my github account)
I use fetch to check what is changed vs my repository


$ git fetch git://github.com/Arora/arora.git master

watch the log
$ git log -p HEAD..FETCH_HEAD

or with gitk

$ gitk HEAD..FETCH_HEAD

I have added an remote repositry (so we have less typing)

$git remote add icefox git://github.com/Arora/arora.git
$ git fetch icefox
From git://github.com/Arora/arora
 * [new branch]      master     -> icefox/master
$git merge icefox/master

Removed src/locale/pt_BR.ts
Merge made by recursive.
arora.pro | 2 +-
autotests/autotests.pro | 1 +
manualtests/manualtests.pro | 4 ++--
src/locale/locale.pri | 5 +++--
src/locale/pt_BR.ts | Bin 43813 -> 0 bytes
src/locale/sk_SK.ts | Bin 0 -> 63590 bytes
src/locale/zh_CN.ts | Bin 0 -> 62833 bytes
src/utils/lineedit.cpp | 39 ++++++++++++++++++++++++---------------
src/utils/lineedit.h | 39 ++++++++++++++++++++++++---------------
src/utils/lineedit_p.h | 39 ++++++++++++++++++++++++---------------
src/utils/proxystyle.h | 2 +-
src/webview.cpp | 2 ++
tools/tools.pro | 7 ++++++-
13 files changed, 88 insertions(+), 52 deletions(-)
delete mode 100644 src/locale/pt_BR.ts
create mode 100644 src/locale/sk_SK.ts
create mode 100644 src/locale/zh_CN.ts

Then i tried to push the changes in my forked repository

git push origin master
To git@github.com:mariuz/arora.git
! [rejected] master -> master (non-fast forward)
error: failed to push some refs to 'git@github.com:mariuz/arora.git'

seems that i have made some changes in the repository at github that i didn't got them down

$ git pull
remote: Counting objects: 8, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 6 (delta 4), reused 0 (delta 0)
Unpacking objects: 100% (6/6), done.
From git@github.com:mariuz/arora
94cffc2..5c00b4c master -> origin/master
Merge made by recursive.
build_arora_qt_snapshot.sh | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

$ git push origin master
Counting objects: 73, done.
Compressing objects: 100% (54/54), done.
Writing objects: 100% (54/54), 22.46 KiB, done.
Total 54 (delta 39), reused 0 (delta 0)
To git@github.com:mariuz/arora.git
5c00b4c..cdb7bb3 master -> master

So here it is the merge was done

http://github.com/mariuz/arora/commits/master

Friday, November 14, 2008

my to do maintain /etc on all servers with git/hg



Maintain /etc with mercurial on Debian
Here is another one with git this time

here is article copy pasted (site seems to be down)

Anyway, here is how you can track your /etc directory with git, and have apt update it
automatically each time a package is installed.




The following steps require root access:




  • install git



    apt-get install git-core

  • initialize /etc to be a git repo



    cd /etc
    git init-db
    chmod og-rwx .git

  • ignore a few files



    cat > .gitignore
    *~
    *.dpkg-new
    *.dpkg-old

  • commit the current state



    git add .
    git commit -a -m"initial import"

  • install a snapshot script for apt to call



    cat > apt/git-snapshot-script
    #!/bin/bash
    set -e
    caller=$(ps axww | grep "^ *$$" -B3 | grep " apt-get " | head -n1 | sed 's/^.*\(apt-get .*\)/\1/' )
    git-add .
    git-commit -a -m"snapshot after: $caller"


    ... make it executable ...



    chmod +x apt/git-snapshot-script

  • configure apt to track changes



    cat >> /etc/apt/apt.conf
    DPkg {
    Post-Invoke {"cd /etc ; ./apt/git-snapshot-script";};
    }

  • track these two files



    git add .
    git commit -a -m"apt will track /etc automagically using git"



... and you're done.



Note that the chmod og-rwx /etc/.git step is very important. Your /etc/.git directory should
only be accessible to root. If not, it's as good as giving everyone access to your /etc/shadow
and other secrets that hide in /etc. Should you clone this repository to another box, you
have to make sure that the same precautions are taken.



Now when you install a package, it will be tracked in the git repository.



    # apt-get install mercurial
...
Created commit daa7de7264b65cd073a1ef0f75ba50aa488d5af2
3 files changed, 409 insertions(+), 0 deletions(-)
create mode 100644 bash_completion.d/mercurial
create mode 100644 mercurial/hgrc
create mode 100644 mercurial/hgrc.d/hgext.rc


You can see what changed...



    # git whatchanged -1
commit daa7de7264b65cd073a1ef0f75ba50aa488d5af2
Author: Bart Trojanowski <bart@jukie.net>
Date: Mon Mar 12 16:09:18 2007 -0400

snapshot after: apt-get install mercurial

:000000 100644 0000000... a7f4740... A bash_completion.d/mercurial
:000000 100644 0000000... dfc3400... A mercurial/hgrc
:000000 100644 0000000... 8f2d526... A mercurial/hgrc.d/hgext.rc





And lastly, it should be noted that debian now has an etckeeper that trackes /etc in git.





ps: i started with /etc/httpd and works well with git

Wednesday, October 08, 2008

getting/building php6 from git

time sudo git clone git://chinstrap.eu/srv/git/php/php-tsrm-ze2.git
Initialized empty Git repository in /opt/build/php-tsrm-ze2/.git/
remote: Counting objects: 378 time sudo git clone git://chinstrap.eu/srv/git/php/php-tsrm-ze2.git
Initialized empty Git repository in /opt/build/php-tsrm-ze2/.git/
remote: Counting objects: 378786, done.
remote: Compressing objects: 100% (75006/75006), done.
remote: Total 378786 (delta 302801), reused 378786 (delta 302801)
Receiving objects: 100% (378786/378786), 128.79 MiB | 1651 KiB/s, done.
Resolving deltas: 100% (302801/302801), done.
Checking out files: 100% (11007/11007), done.

real 4m35.256s
user 2m41.826s
sys 0m7.860s
786, done.
remote: Compressing objects: 100% (75006/75006), done.
remote: Total 378786 (delta 302801), reused 378786 (delta 302801)
Receiving objects: 100% (378786/378786), 128.79 MiB | 1651 KiB/s, done.
Resolving deltas: 100% (302801/302801), done.
Checking out files: 100% (11007/11007), done.

real 4m35.256s
user 2m41.826s
sys 0m7.860s

mariuz@borkstation64:/opt/build/php-tsrm-ze2$ sudo ./buildconf
using default Zend directory
buildconf: checking installation...
buildconf: autoconf version 2.61 (ok)
buildconf: Your version of autoconf likely contains buggy cache code.
Running cvsclean for you.
To avoid this, install autoconf-2.13.
rebuilding aclocal.m4
rebuilding configure
rebuilding acconfig.h
rebuilding main/php_config.h.in
autoheader: WARNING: Using auxiliary files such as `acconfig.h', `config.h.bot'
autoheader: WARNING: and `config.h.top', to define templates for `config.h.in'
autoheader: WARNING: is deprecated and discouraged.
autoheader:
autoheader: WARNING: Using the third argument of `AC_DEFINE' and
autoheader: WARNING: `AC_DEFINE_UNQUOTED' allows one to define a template without
autoheader: WARNING: `acconfig.h':
autoheader:
autoheader: WARNING: AC_DEFINE([NEED_FUNC_MAIN], 1,
autoheader: [Define if a function `main' is needed.])
autoheader:
autoheader: WARNING: More sophisticated templates can also be produced, see the
autoheader: WARNING: documentation.

sudo apt-get install libicu-dev

create configure script
to look this way
cat conf.sh
#! /bin/sh
#
# Created by configure

'./configure' \
'--disable-all' \
'--with-interbase' \
'--prefix=/opt/php5.3' \
'--disable-cgi' \
'--disable-cgi' \
'--enable-debug' \
'--enable-maintainer-zts' \
"$@"


$ sudo sh conf.sh

$ sudo su
#make test > out.err

inspect the out.err

install it
# make install


/opt/php5.3/bin/php -v
PHP 6.0.0-dev (cli) (built: Oct 8 2008 22:50:48) (DEBUG)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v3.0.0-dev, Copyright (c) 1998-2008 Zend Technologies

Friday, September 05, 2008

Php + Grannymade Ganymede Packages (based on Eclipse 3.4) on Ubuntu

Download eclipse distro that you need
http://www.eclipse.org/downloads/

In my case i choose eclipse classic on amd64/x64
http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.4-200806172000/eclipse-SDK-3.4-linux-gtk-x86_64.tar.gz

and i unziped it in /opt

Install phpeclipse for it
http://www.phpeclipse.de/wiki/Installation

Install subclipse
http://subclipse.tigris.org/install.html

I have modified in eclipse.ini the max memory used by jvm to be 2048M
-Xmx2048m

And added this for native subversion library used by subclipse
-Djava.library.path=/usr/lib/jni


And is better to use the JAVAHL - JNI interface for subclipse
otherwise you can have troubles with the pure java implementation (locks and other things)

install Java bindings for Subversion

$sudo apt-get install libsvn-java

and from Eclipse
Window -> Preferences ->Team -> SVN
Be shure to be JAVAHL - JNI interface for subclipse selected

Image

Here is my final setup

Image
Next is to install egit

http://git.or.cz/gitwiki/EclipsePlugin

http://cho.hapgoods.com/wordpress/?p=159

Wednesday, September 03, 2008

github in fact is a social network based on git.
I blog in code or code in the blog

quote of the day via

http://intertwingly.net/blog/2008/07/18/Life-after-Bug-Tracking-Systems

Sunday, April 13, 2008

Build VLC media player under Ubuntu Hardy (8.04) from git

Here is the full howto
The only addition i can make : vlc and ffmpeg switched to git
so to extract the x264 library you would need these command lines

$ cd extras
$ git clone git://git.videolan.org/x264.git
$ git clone git://git.mplayerhq.hu/ffmpeg/
$
cd ffmpeg
$ git clone git://git.mplayerhq.hu/libswscale/

Wednesday, November 21, 2007

Using Git for Samba Development - vs OOPS i deleted the svn server

In the future (at reea maybe)
we can use  an true distributed VCS like GIT/Bazaar/Mercurial

http://en.wikipedia.org/wiki/Git_%28software%29
http://bazaar-vcs.org/
http://www.selenic.com/mercurial/wiki/

http://ianclatworthy.files.wordpress.com/2007/10/dvcs-why-and-how3.pdf

Many projects like samba and mozilla are switching from svn to something better and distributed (no SPOF)
http://wiki.samba.org/index.php/Using_Git_for_Samba_Development


ps: SPOF = single point of failure or OOps i deleted the SVN server


Using Git for Samba Development - SambaWiki

Blogged with Flock