Showing posts with label GIT. Show all posts
Showing posts with label GIT. Show all posts

Thursday, February 28, 2013

Delete a remote tag

First delete it from local
git tag -d tag_name

Then push the change to remote
git push origin :refs/tags/tag_name

Thursday, October 18, 2012

GIT rebasing and pull request processing

Minor explanation with example

Checkout to master

$ git pull --rebase origin master

Create a new branch for each feature. Say we are implementing a new feature => feature1, create a branch

$ git checkout -b feature1 

Now we have a copy of master in feature1 branch. Now you can work on this branch. It will be better to commit all changes at last before pushing the branch. If we have created this branch long time ago, by the time the master would have got updated from other developers. So, checkout to master and run $ git pull --rebase origin master and then checkout to feature1.

$ git rebase master
If merge conflict occurs in our rebase then resolve the conflict and stage the files, please dont commit them and run $ git rebase --continue or abort the rebase by $ git rebase --abort.

Commit and push the new branch

$ git push origin feature1

When its done, after accessing the branch through browser initiate the pull request. On initiating pull request we can set the base merge branch. The pull request can be accepted and merged if a link below called Merge is shown in green (ready to go).

If we need to merge multiple commits to one 

Now use git log, which lists the commits. If we want to merge the last 2 commits then use

$ git rebase -i HEAD~2 

Update the commits to be squashed and picked. On squashing the commit will be merged to a the picked one then, save the commit and push the branch using 

$ git push -f origin feature1 


Wednesday, January 4, 2012

Openshift with MySQL PHPMyAdmin

Click here to set up the Openshift server with Ubuntu.

Install Mysql for Openshift

/var/lib/gems/1.8/bin/rhc-ctl-app -a APPNAME -e add-mysql-5.1 -l EMAILID -p PASSWORD

Now Mysql is installed and access details will be obtained after running the above command.

Install PHPMyAdmin 

Download PHPMyadmin 


Go to application folder (local) and unzip the downloaded file

cd APP_FOLDER_NAME/phpunzip ../../

Rename the folder (name will be used to access the mysql [domainname/phpmyadmin_foldername])

mv phpMyAdmin-3.4.8-all-languages phpmyadmin

Update Configuration file for phpmyadmin

cd phpmyadmincp$cfg['blowfish_secret']     = 'some value'; //COOKIE AUTH$cfg['Servers'][$i]['host'] = 'hostadress'; //host address obtained on mysql installation

Add files to be pushed to the server, and commit the changes

git add -Agit commit -m 'phpmyadmin setup'git push 

After pushing the changes to server, mysql can be accessed through

Then login using the credentials obtained on MySql installation

Wednesday, April 6, 2011

GIT Committing to a different remote branch

From master

git branch -a

gives the list of all remote branches

Create remote branch in local and get all the updates from the corresponding branch

git branch -t branch_name(same as in server) origin/branch_name

git checkout branch branch_name

make changes

commit ur code


git pull origin branch_name

git push origin branch_name

Friday, March 18, 2011

GIT repository

Setting up GIT in Linux

Step 1 : Add user account in

Step 2 : Install GIT and GIT GUI in your machine.

Step 3 : Then open the terminal and type git gui, a popup window will come.
             From that select Help -> Show SSH Key, copy the key and add it to your GITHUB account.

Step 4 : There are 2 types of repositories in GITHUB
             1. Public
             2. Private
             In your dashboard Repositories will be listed.

Step 5 : Select a repository
             There will be SSH url copy that and go to your machines web folder in your machine through
             Terminal where you want to create a copy of the project.

Step 6 : Then type  :  git clone {sshurl} here ssh url is the url copied from the GITHUB Repository.

Step 7 : When this command is executed the clone from the repository is generated in your local machine.
            Then browse to the project folder.

Step 8 : If you want to create a branch (i.e. view)  in your machine which will not affect the MASTER (i.e. copy of the project from server)
            use git branch branch_name will create a new branch. Then use git checkout branch_name will checkout into the branch.
            Now you can work on your own branch.

Step 9 : After working on your branch, if you need to add some of your changes to the git repository use git gui command inside your project folder.
            A popup comes with 3 frames. Left most one will be the files that has been changed based on the master copy.
            On selecting the file it shows the changes that you have made on the file based on the Master copy on the right side frame(biggest).
            On the right side there are 2 sections : one is the files that are been changed. On double clicking on the files it will move to the staged section
            i.e. files to be merged with the master copy. Then on the right side bottom there is section for specifying your comment on the updation.
            After adding the comment press the commit button. Before merging the files into the master copy you have to stack (buffer) the changes that
            you have made for other files which are not to be merged to the master copy.

Step 10 : use git stash to stack your local changes then checkout to your master copy using git checkout master. Then take all the updates from server
            using git pull. Then merge the updates that you have committed to the master copy using git merge branch_name.
            Now you have made the changes to the master and can be pushed to the github repository by using git push

Step 11 : Then is you need your local changes to be applied back, checkout to your branch using git checkout branch_name,
            now you have to apply the updates obtained from the github repository by git rebase master (which resets your branch to the master copy).
            Now you need to apply your local changes which has been stacked before merging, by git stash pop, again you can work separately on your local copy.