IT notes


To create a git repository and access to it via ssh: $ ssh $ mkdir my-new-repo $ cd my-new-repo $ git --bare init To access your repo (clone it): $ git clone ssh://[email protected]:2222/~user/my-new-repo

git basics

git branch -a This will print all branches, local or remote, to see only local branches: $ git branch To only see remote branches: $ git branch -r When you clone a repo after typing git branch -a the output will look something like this: $ git branch -a * master remotes/origin/HEAD -> origin/master remotes/origin/master master is a branch in the local repository, remotes/origin/master is a branch named master on the remote named origin:

Git Web Deployment Workflow

The idea behind is to push to a remote repository on the same web/service server and a post-receive hook will checkout the files to the public directory. Configuring the server Create the repository: $ cd $HOME $ mkdir my-site.git $ cd my-site.git $ git init --bare The idea of using .git as a suffix is just to distinguish between other directories. Crate the directory where you would like to deploy, for example:

git format-patch

To create a patch of the latest commit: git format-patch -1 HEAD The last 10 patches from head in a single patch file: git format-patch -10 HEAD --stdout > last-10-commits.patch Apply the patch: git apply path-file-name

brew update formula

Example: brew bump-formula-pr --strict --url immortal it will need an API GIT token: export HOMEBREW_GITHUB_API_TOKEN=XXXXX To keep in sync forked repo: git fetch upstream git co upstream/master git push -f origin master

brew macos

Homebrew installs the stuff you need that Apple didn’t. For example to update python and avoid many SSL warnings: brew install python To use an updated version of git on mac use: brew install git --whitout-completion To update vim: brew install vim --with-override-system-vi Updating zsh: # check the zsh info brew info zsh # install zsh brew install zsh # add shell path sudo vim /etc/shells # add the following line into the very end of the file(/etc/shells) /usr/local/bin/zsh # change default shell chsh -s /usr/local/bin/zsh Install some extra packages in oneline: