Saturday, December 21, 2013

How to Push to a Local Repository Using Git

Typically I needed to push to a local repository when the remote one in our office was temporarily unavailable. 

Suppose you have got a project called My_Project and use Git for source code management. If you would like ti set up a repository on your local machine to push to it, this guide can be useful to you.

Let's start.
  1. Go to the directory with your project.
  2. Init a repository in this directory using git init
  3. After changing some files, commit them using git add -A and git commit -m "Initial commit"
  4. Create a directory called My_Repo.git on your local machine. It will be your local repository. Let's create it in the home directory.
  5. Go to My_Repo.git.
  6. Run git init --bare
  7. Go back to the My_Project
  8. Add the full path of My_Repo.git to a list of repositories of your project. 
git remote add local /home/maksim-dmitriev/My_Repo.git

You are ready to push to your local repository.

git push local master

And then push, clone, and pull as usual.

Saturday, September 21, 2013

Running Google Chrome with a Specified Profile on Linux

I have got two Google Chrome profiles, and each of them has its own history, bookmarks, settings, etc. In order to run the browser with a specified profile, I created a little Bash script called chrome and saved it in the $HOME/bin directory.

#!/bin/bash

if [ "$1" = "ks" ]
then 
    google-chrome --profile-directory=Default
    echo X
elif [ "$1" = "x" ]
then 
    google-chrome --profile-directory="Profile 1"
else
    echo "Wrong argument"
fi 

For example, my name is Maksim, and it can be spelled as Maxim or Maksim

If I use a Google account where my name is spelled as Maksim, I run chrome ks. And when I use my second Google account where my name is spelled as Maxim, I run chrome x.

http://superuser.com/a/377195/150464
Thanks, guys!