Tuesday, September 24, 2013

Git: The Current Branch is not Configured for Pull




Fixing the Git Error:  The Current Branch is not Configured for Pull


Are you trying to perform a git pull from a remote git repo within Eclipse?  Does the pull request work for your master branch but not on other branches?


Are you seeing an error message like below:



The current branch is not configured for pull
No value for key branch.develop.merge found in configuration


Or an error message such as the following:

The current branch is not configured for pullNo value for key remote.origin.url found in configuration



The current branch is not configured for pull. No value for key branch.develop.merge found in configuration.
Error message trying to pull from a remote git branch


Most likely, you created the branch locally and you haven't set the merge section of that branch and/or your local branch is not tracking the remote branch.  The problem lies in your git local configuration.

There are many ways to fix this but the most straightforward for me is the following:


Open up your Git Bash:

Location of git Bash command prompt
Open your git bash from the Start Menu


Right-click your project and click properties.  Get the location of your project in git.

Finding the location of your local project
Find the local git repo location of your project in your IDE



Go to your git prompt:


Your git bash command prompt
Git Bash command prompt


Change your directory to your project's directory.  Be sure to use forward slashes!

cd C:/Users/your-username/git/your-path

Checkout the branch


git checkout branchname

 Then push the local branch to your remote branch using the -u flag.  This will setup your pull settings automatically.


git push -u origin branchname


This should automatically update your local configuration and you should now be able to execute a git pull command for that branch from the remote repo.




Alternatively, you can modify the config directly

C:\Users\yourusername\git\yourprojectname\.git\config

Then add the following entry for your branch.


[branch "master"]
remote = origin
merge = refs/heads/master



--
APNSG5FMT284 Software Development Blogs - BlogCatalog Blog Directory

Wednesday, September 18, 2013

Auto Refresh and Reload Changes When Using a Custom Env in Grails on your Local Machine



Setup Flags/Params to get Auto-Refresh/Auto-Reload of Changes Behavior in a Custom Grails Env when running Locally

   

OK, so you need to use a Custom Environment in Grails while developing and running on your local machine.  Unlike when using the basic develop Env, when you make some changes and refresh the page, the changes aren't there.  


Well, it turns out several flags and settings which are enabled by default in Dev mode will not be set when you create your own custom environment.  Many of these flags and settings include features that auto refresh and reload changes you make in the code and deploy those changes.  This is because these settings are processor intensive and you would not want these settings going to PROD.

This tutorial will show you how to enable those flags and settings so that you automatically refresh and reload changes on your local machine when running a custom env.

Just to reiterate, these settings are for development.  Don't use them on PROD.




STEP 1 - Setup the Run Config

First you want to:



  • Right-click your project
  • Select "Run As"
  • Select "Run Configurations"



How to get to the run config
Navigate to the Run Configurations Screen




Then you want to modify the grails command as such:

-reloading -Dgrails.env=custom  run-app

Make sure - reloading is the first arg! JIRA link to issue with flags here


Add custom VM params
Add params to your run config


What does this do?

It does two things:


  1. When you do a basic run-app command, it will automatically run the app in the custom environment
  2. It passes the -reloading flag 


STEP 2 - Modify your config.groovy

Yes, you can also pass these params in to the command line and add them as flags in your run config.  In my experience, things can get a little buggy and hard to manage if you pass too many flags in your run config.


This way is easier to read, modify and manage as well.


First, open your local config.groovy file.


Update your configuration:  Config.groovy location
How to find your config.groovy



Then update your local configuration by adding the following arguments to your config.groovy file:


Groovy Config parameters:  disable.auto.recompile=false and grails.gsp.enable.reload=true
Add these params to your config file


The config parameter, disable.auto.recompile=false and grails.gsp.enable.reload=true will refresh your application after you save your gsp and code changes in your IDE.


Save everything and restart your IDE.  You should see changes to GSPs and code immediately without having to restart the server when developing in Grails.







References:
Grails.org Auto Reloading Page
Grails JIRA Issue about this



RTS Labs
Software Development Blogs - BlogCatalog Blog Directory