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

Monday, June 22, 2015

Git repository branch merge

When you try to merge two branches, It does not require any PullRequest to do the task. Internal repository code merge can be done using local .

Even we can do the pull request using one the repository console link. But I may be end up with the conflict error. Be conscious on what you gonna do. You may not get option to resolve it on the online editor.

Need to know how to do, You have to follow this steps.

1) Go to  repository location
2) Project1<REL-2.0.X> $ git pull
3) Project1<REL-2.0.X> $ git merge REL-1.7.X  
4) Destination <-- Source

Source is 2.0 and destination 1.7 (Don't be confused with this repository versions).
Finally you will get the all source code changes on 1.7 version will be available on the 2.0.

If you done some mistake during this merge, follow this to revert.
(Get the merge commit version)

git revert -m 1 26a0837
git push
(Note :  1 is first parent, and 26a0837 is commit id.)


Wednesday, January 22, 2014

Git configuration with Bitbuket

Bitbuket.org an implementation of git.
It provide you a private repository with free of cost up to 5 user access.

Requirement:
  1. Git software Download and install msysgit from here.
  2. An account in bitbuket

Step to simple project setup:
→ Open git-bash software
Check .ssh folder created at your user folder [$ssh -v]

Generating public/private rsa key pair [$ssh-keygen]
Create config file in your .ssh folder
paste the following
Host bitbucket.org
 IdentityFile ~/.ssh/id_rsa
save it
Restart the terminal

Create .bashrc at root of your user home directory
paste the following scipt

SSH_ENV=$HOME/.ssh/environment
   
# start the ssh-agent
function start_agent {
    echo "Initializing new SSH agent..."
    # spawn ssh-agent
    /usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
    echo succeeded
    chmod 600 "${SSH_ENV}"
    . "${SSH_ENV}" > /dev/null
    /usr/bin/ssh-add
}
   
if [ -f "${SSH_ENV}" ]; then
     . "${SSH_ENV}" > /dev/null
     ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
        start_agent;
    }
else
    start_agent;
fi


Save and close the file and reopen the git

Ssh add
$ ssh-add -l

Install the public key on your Bitbucket account

cat ~/.ssh/id_rsa.pub
Select and copy the key output in the clipboard.

Login to bitbuket account and goto manage account → sshkey tab (On the left side of page)
Add and save the key with suitable name.

create .gitconfig file in the root directory of  your user home and add the below in the file

[user]
    name = username
    email = registedgmail@xxx.com 
save and close
Return to the terminal window and verify your configuration by entering the following command

ssh -T git@bitbucket.org
The authenticity of host 'bitbucket.org (131.103.20.167)' can't be established.
press yes and it will create the configuration.
try again the
ssh -T git@bitbucket.org
Note : if you get your name printed in the terminal. You achieved it.


Merging two sorted arrays - Big O (n+m) time complexity

 Problem :  Merge the two sorted arrays. Edge case :  Array can empty Arrays can be in different size let getMaxLength = ( input1 , input...