четверг, 26 сентября 2013 г.

Git crib

Git

Git is a free & open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Configuration

Set Name and Email Address

$ git config --global user.name "Your Name"
$ git config --global user.email "yourname@yourdomain.com"

Set Colors

$ git config color.ui true

General Commands

Create a Repository

$ mkdir project
$ cd project
$ git init

Ignore Files or Directories

Create .gitignore and add file and directory globs:
dist
tmp
log
.DS_Store

See List of Changed Files

$ git status

See Difference of Files

$ git diff

Stage Files for Committing

$ git add foo.txt
$ git add bar.txt

Unstage a File

$ git reset HEAD bar.txt

See Differences of Staged Files

$ git diff --cached

Commit Staged Files

$ commit -m "Your Message Here"

Revert a Changed File

$ git checkout name/of/file

Branching

Create a Branch

$ git branch <branchName>

Switch to a Branch

$ git checkout <branchName>

Create and Switch to Branch

$ git checkout -b <branchName>

Switch back to master Branch

$ git checkout master

List Local Branches

$ git branch

List Remote Branches

$ git branch -r

List Local and Remote Branches

$ git branch -a

Merge changes from another Branch

$ git merge <branchName>

Rename a Branch

$ git branch -m <currentName> <newName>

Force Rename of Branch

$ git branch -M <currentName> <newName>

Delete a Branch if differences have been merged into current branch

$ git branch -d <branchName>

Force Deletion of Branch

$ git branch -D <branchName>

Delete Remote Branch

$ git branch -d -r <remoteName>/<branchName>
$ git push <remoteName> :<branchName>

Remote Repositories

Show List of Remote Repositories

$ git remote

Add a Remote Repository

$ git remote add <remoteName> <url>

Remove a Remote Repository

$ git remote rm <remoteName>

Rename a Remote Repository

$ git remote rename <oldRemoteName> <newRemoteName>

Push to a Remote Repository

$ git push <remoteName> <branchName>

Pushing to Multiple Remote Repositories at Once

If you want to push to multiple remote repositories using a single name you can first add the two remotes separately and then end .git/config to add a third remote that combines both of them together:
[remote "heroku"]
 url = git@heroku.com:bnd-notes.git
 fetch = +refs/heads/*:refs/remotes/heroku/*
[remote "github"]
 url = git@github.com:buildndeploy/notes.git
 fetch = +refs/heads/*:refs/remotes/github/*
[remote "external"]
    url = git@github.com:buildndeploy/notes.git
 url = git@heroku.com:bnd-notes.git
 fetch = +refs/heads/*:refs/remotes/heroku/*
Then you can update them with a single command:
$ git push external

Stashes

git stash / git stash save
git stash list
git stash apply <stash>
git stash apply stash@{0}
git stash pop

GitHub Fork Merge

$ git remote add upstream git://github.com/qgis/Quantum-GIS.git
$ git fetch upstream
$ git merge upstream/master

четверг, 5 сентября 2013 г.

[CENTOS6] Настраиваем алтернативы для Java

export java_home=/usr/java/default
/usr/sbin/update-alternatives --install /usr/bin/java java ${java_home}/bin/java 20000 \
                                --slave /usr/bin/keytool keytool ${java_home}/bin/keytool \
                                --slave /usr/bin/orbd orbd ${java_home}/bin/orbd \
                                --slave /usr/bin/pack200 pack200 ${java_home}/bin/pack200 \
                                --slave /usr/bin/rmid rmid ${java_home}/bin/rmid \
                                --slave /usr/bin/rmiregistry rmiregistry ${java_home}/bin/rmiregistry \
                                --slave /usr/bin/servertool servertool ${java_home}/bin/servertool \
                                --slave /usr/bin/tnameserv tnameserv ${java_home}/bin/tnameserv \
                                --slave /usr/bin/unpack200 unpack200 ${java_home}/bin/unpack200 \
                                --slave /usr/lib/jvm/jre jre ${java_home} \

четверг, 29 августа 2013 г.

[RPM] Встроенные макросы

Built-in macros

RPM includes a host of built-in macros, including the following useful directories:
%_prefix /usr
%_exec_prefix %{_prefix}
%_bindir %{_exec_prefix}/bin
%_sbindir %{_exec_prefix}/sbin
%_libexecdir %{_exec_prefix}/libexec
%_datadir %{_prefix}/share
%_sysconfdir %{_prefix}/etc
%_sharedstatedir %{_prefix}/com
%_localstatedir %{_prefix}/var
%_libdir %{_exec_prefix}/lib
%_includedir %{_prefix}/include
%_oldincludedir /usr/include
%_infodir %{_prefix}/info
%_mandir %{_prefix}/man
The example directories shown above come from the standard RPM macro file, /usr/lib/rpm/macros, instead of the Red Hat-specific file, /usr/lib/rpm/redhat/macros, which holds:
%_prefix /usr
%_sysconfdir /etc
%_localstatedir /var
%_infodir /usr/share/info
%_mandir /usr/share/man
%_initrddir %{_sysconfdir}/rc.d/init.d
%_defaultdocdir %{_usr}/share/doc

[DEBIAN] Устанавливаем локаль ru_RU.UTF8

apt-get install locales - на все вопросы вносим Y. vi /etc/environment - открываем файл на редактирование и удаляем из него любые записи и вносим одну: LANG="ru_RU.UTF-8"
Помощь по использованию vi находится здесь: Vi или откройте файл через WinSCP
Редактируем файл /etc/locale.gen тем же vi: vi /etc/locale.gen - В списке находим ru_RU.UTF-8 UTF-8 и удаляем значек # перед записью. Сохраняем файл.
locale-gen - запускаем команду для генерации локали. Пример ниже:
root@test:~# locale-gen
Generating locales (this might take a while)...
ru_RU.UTF-8... done
Generation complete.
Перезаходим на сервер. В клиенте, который Вы используете для связи с сервером делаем следующее (большинство людей использует Putty: SSH):
После того как Вы вошли на сервер, кликните на верхнюю часть окна Putty правой кнопкой мыши, выше черного. Выберите Change Settings -> Window - Translation -> из списка выберите UTF-8 и нажмите Apply внизу.
Теперь Вы сможете видеть русский язык в окне связи с сервером при выполнении различных команд.

четверг, 30 мая 2013 г.

How do I find what dependencies a rpm file has?

RPM is a Package Manager for popular distribution such as Red Hat, Suse and many others. It is a powerful command line package management system for installing uninstalling, verifying, querying, and updating Linux computer software packages.
You can finding out what dependencies a rpm file has i.e. it will tell you what you need to install package with following command:
rpm -qpR {.rpm-file}
rpm -qR {package-name}


Otherwise you can try to install it end will get error message if some of the deps wouldnot be installed.
rpm -ivh {.rpm-file}

Цинизм в IT: Как собирать RPM под CentOS 5?

Цинизм в IT: Как собирать RPM под CentOS 5?