Thursday, September 26, 2013

Setup Stash a Git management solution

Setup Stash a Git management solution
In this post, i will be discussing about the stash setup.  Statsh is a Git repository management solution from

Atlassian. (More on this is available in their confluence web site:

https://confluence.atlassian.com/display/STASH026/Getting+started

In order to use stash you need following installed:

- Need to buy stash account
- Need to have a stash account and password
- Account -> add ssh key.  ( you can generate it if it does not exist using)
- Make sure you have full access to write/read etc in the stash repo.

You are all set to access the stash.

Setting up the remote repo:

Modify the existing project (for example: ssh://git@stash.dev-sample.net:7999/stash/project1.git) to your local

repo:

1. Create a folder for the project. Say in C:\Workspace\Stash_project_1
2. Enter the below command:
>git clone ssh://git@stash.dev-sample.net:7999/stash/project1.git
you will see below output:
Cloning into 'project1'...
remote: Counting objects: 332, done.
remote: Compressing objects: 100% (229/229), done.
remote: Total 332 (delta 87), reused 332 (delta 87)
Receiving objects: 100% (332/332), 2.16 MiB | 427.00 KiB/s, done.
Resolving deltas: 100% (87/87), done.

3.  Make the changes in the local repo.
4.  Its time to commit the changes:

> git commit -a

It will show text editor for comments.  Enter the comments and press esc key -> wq! (to save the command and quit)

> You might see something like below:

You can suppress this message by setting them explicitly:

    git config --global user.name "Your Name"
    git config --global user.email you@example.com

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

> If you want to change anything like user.name or user.email.  Please go ahead and execute the above command and

do a amend that follows.  Now are you all set.

5.  Login into stash and check the project: : Stash -> repo: Project1.
- you should be able to see commits under the commit tab.

Create a new branch:
======================

1. Go to the local repo path (make sure it has the .git folder in it, other wise, you need to make it as one).
2.  Enter the below command to create a branch called SampleBranch1.

git checkout -b SampleBranch1

3.  Below command is used to push the branch to the remote repo.

git push origin SampleBranch1

4. Run the below command to check if the branch is created.  (* indicate new branch)
git branch


Checkout from a branch:
git clone -b SampleBranch1 --single-branch  ssh://git@stash.dev-sample.net:7999/stash/project1.git

Keep checking this space for more info on stash. Thanks for checking my blog