Git Conflicts in Astera Centerprise¶
A conflict arises in Git when two separate branches have made edits to the same line in a file, or when a file has been deleted in one branch but edited in the other.
In the Git functionality of Astera Centerprise, a conflict can occur if two files of the same name are merged from two different branches or while pulling the branch from the remote. If the files on the remote and the local have differences, a conflict will occur.
For our conflict and resolution use case, let us look at the following branches.
Accessing a Conflict in Git in Astera Centerprise¶
As you can see in the Git Branches Browser, we have two branches available.
In Branch01, we have a dataflow present by the name of ‘GitDataflow01’.
In Branch02, we have a dataflow present with the name of ‘GitDataflow01’.
Note: The use cases of both flows are different, but the name is the same.
Now, we right-click on the first branch and select Merge Into Current Branch from the context menu.
Doing so is going to create a conflict between the branches and will produce an error.
As you can see in the Git Changes Browser, a new node has appeared underneath Staged and Unstaged: Conflicted.
Resolving a Conflict in Git in Astera Centerprise¶
To resolve a conflict in Git in Astera Centerprise, right-click on the affected file in the Conflicted node.
Note: The conflict has emerged because Git in Astera Centeprise compared both the files and found similarities with the name of the file.
Firstly, you can preview each of the files in the two branches to compare them. If we expand the Preview option, we can see two further options,
Current (Local): Selecting this will preview the conflicting file in the current branch.
Incoming (Remote): Selecting this will preview the conflicting file in the second branch which is to be merged into the current branch.
Secondly, you can expand the Resolve option and two further options can be seen,
Keep Current (Local): Selecting this option will keep the conflicting file in the current branch and exclude the second one.
Take Incoming (Remote): Selecting this option will keep the conflicting file in the second branch and exclude the local one.
Note: When we are resolving a conflict, Astera Centerprise compares both conflicting files and keeps whichever one we select as our application.
At any time during this process, you can abort the merge simply by selecting the button at the bottom of the Git Changes Browser.
This will roll back the entire process to before the merge option selection.
For our use case, we will keep the current branch file when resolving the conflict,
Note: The merge is not complete until a commit is made.
We write a summary and commit.
The two branches have successfully merged.
As you can see now, the file from the current branch remains after the merge is complete.
This concludes the accessing and resolution of conflicts in Git in Astera Centerprise.