Menu

Resolve code merge conflicts

In this blog post, we are going to learn to resolve the conflicts with merge requests or pull requests in Git codebase. 

Let's assume we have two branches and trying to merging code from develop branch to master branch. 

Git merge conflicts | Atlassian

Source branch: develop

Destination branch: master

Step1: Open Git bash and check out the latest source branch code in local directory. e.g. git checkout develop This Git command will pull the latest code from develop branch in the local repo and this will change the current working branch to develop in Git Bash. 

Step2: Now we need to pull the code of the destination branch into the source branch. Hence in our case, we will run Git command git pull origin master. This command will pull the code from the destination and match it with the source. This will also show you a list of all the files where conflict needs to be resolve to successfully merge. 

Example: 

Auto-merging src/header.java
CONFLICT (content): Merge conflict in src/header.java
Automatic merge failed; fix conflicts and then commit the result.

Step3: Now open your developer IDE and look for above mentioned file [src/header.java], and see where the conflict is. IDE by default also gives some hint to accept the source changes or destination changes, you may just click on that option and keep and go only with one change. If you think that option is not sufficed your need and you have to manually make some changes in code then go ahead and make the required changes and save the changes.

Step4: Since we have fixed the code changes, now it is time to check-in the code into the source branch. To check-in the code uses the below commands in Git one by one.

git add <file name> or .(dot) if we wants to add all the files.

git commit -m "commit message"

git push origin develop


Step5: Now go to merge request and see, the conflicts will be get resolved. And now we could merge the code.

 

Reference:

Bitbucket merge conflict

Setup DynamoDB in local machine and use as SQL

DynamoDB is a NoSQL database provided by Amazon. Those who are working on Dynamo DB always have to connect and work on dynamo DB using the web browser. But now Amazon came with NoSQL workbench that is an application which helps developers to connect with dynamo DB instance hosted on Amazon or local dynamo DB installed in local machine. Let's see how a NoSQL workbenchhelps developer and how a developer can connect and use NoSQL Workbench.
 

Prerequisite

You should have the latest Docker installed in your local machine.

Install and Setup DynamoDB

 
1. Run the docker.
2. Download the latest DynamoDB Docker image. 
2.1 Open a command prompt and run this command to download the docker image file for dynamo DB.
The command needs to run docker pull amazon/dynamodb-local

Download dynamo DB docker image
Download dynamo DB docker image


2.2 To start the docker run the following command docker run -d 8000:8000 amazon/dynamodb-local
Status of docker image downloading

2.3 Check the status of docker using command >> docker ps


3. Download the NoSQL workbench tool from Amazon site.  

4. Open the NoSQL workbench, go to operation builder and click on "Add connection" to create a new database connection.
NoSQL benchmark for Amazon DynamoDB
NoSQL benchmark for Amazon DynamoDB

5. Now NoSQL benchmark is connected with dynamoDB. You can now run your SQL command and perform transactions.

Hope this helps you! Thank You!  

Error occurred during initialization of VM, could not reserve enough space for object heap

When we try to run any Java application that required more heap memory or we have explicitly set the heap memory -Xmx. e.g. to set heap memory to 512 MB of RAM(Random Access Memory) size use, -Xmx512M 

Solution:

There could be multiple ways to fix this issue.

1. Restart the Virtual Machine or system.

2. Set environment variable JAVA_OPTS=-Xms256M. To read more on the environment variable read here.