Thursday, April 19, 2018

Continuous Integration, Delivery and Deployment driven by Git

I have it, I like it.

This is the simpliest idea that removes excecive "must remember" and "must do" workflows in the software development process.

Do you know Git Flow? This is all, your developers should know.

You use a convention that reflects your development, test and production evnvironments.
Say, you create Git-branches such as
  • dev
  • dev_stand
  • test
  • test_stand
  • uat_stand
  • prod_stand
Farther, you tune your automation to react appropriately to changes in such branches.
This is really easy in our days.

This can be
  • Project Buildings
  • Obfuscation
  • Static Code Analysis
  • Unit Testing
  • Packaging
  • Deploying
  • Data Updating from a production
  • Notifications
  • Integration Testing
  • Other dev systems integration, etc.

Thursday, March 29, 2018

Git Automated Conflict Solving

(draft, thoughts)

Every Git repository is a separate universe. I mean, even your local repository may be considered as a primary remote repository at any time.
So, how to merge two universes? By force, coercion and fire? Nope, USA is not applicable here, we always lose valuable pieces of work (world) in such a way.

Convention over Git approach is arising here.
First you agree to only sync branches under a naming convention.

You allow to push commits to your side repo freely and automatically until they do not conflict with yours.
If they conflict, another side is free to do, say, a Git-rebase and retry.
CoG deals with and separates notions of Non Fast Forward and Fast Forward commits of Git.
See CoG link, to take it deeper.

To recap, you are in an awkward position with your wishes, because this kind of things is uncommon in the Git world and is not researched well.

That's all. Have questions?

Monday, February 19, 2018

Pure Git with Convention over Git

It is an implementation of remote Git repositories synchronization by the pure Git and the Convention over Git.

This approach uses well-known Git tools, because Git has an innate ability to do such synchronizations.
All we need to add to Git is some convention.

(Consider to use git-sinc, the next generation of remote Git repositories synchronization.)

The situation

Say, we have teams in separate companies. Each team owns their own repository hosted on their own separate git server. This often happens for vendor-client scenarios.

The targets
  • Create a single force, a single team.
  • Eliminate severe and constant errors as a result of disunity.
  • Eliminate significant time wasting.
  • No single repository, no team's heart beating.
I even call this approach as Conventional Distributed Version Control System over Git.

Saturday, February 17, 2018

Approaches to synchronize remote Git repositories

Pure Git

Implementation: Pure Git with Convention over Git

It uses pure Git techniques.
This one is more academic but fully working.
Has some limitations.
Has the smallest amount of implementation dependencies.
*nix & Windows ready.

Stateless Analysis

Implementation: git-sync

The best approach. But it has more implementation dependencies: gawk, modern bash.
*nix & Windows ready.

Stateful Analysis

It depends on collected information about Git refs.
It has a wider set of conflict solving tools.
Predecessor of all other approaches.
Requires a modern software language, an IDE and good programming practices.

Implicit Renaming of Refs

My beloved.
Belongs to the Stateless Analysis.
It implies convenient manual conflict solving on the run.
It is kinda Git inside the Git with an additional degree of external references.

Friday, February 16, 2018

Glossary of synchronization of remote Git repositories

One of the approaches to automatically solve conflicts of synchronization between remote Git repositories.

safe, non-overwriting git fetch or push.

unsafe, forced & overwriting git fetch or push.

directly related one remote and many local git repositories. They are located on one side, i.e. in one company.

owner of the side. A team that owns and uses their remote repository directly.

git references, mostly such as branches and tags.

conventional refs
refs strictly separated by a convention and pertaining to different different sides. Each side owns its refs but can modify refs of another.

prefixed refs
This is a naming convention and an implementation of conventional refs by prefixes.
As an example:
"company1/some_feature", "company2-develop"
where the "company1/" and "company2-" are the conventional prefixes.

It specifies source and destination refs and can specify a non-fast-forward Git-fetch or -push by the plus "+" sign at the beginning.

synchronization interval
It is an interval between two synchronizations of remote Git repositories. Usually it is from one to three minutes.

Git Garbage Collector.

synchronization agent. Some implementation that doing all the work.

Saturday, September 30, 2017

Day-to-day use of the Pure Git with Convention over Git

This page explains how to use the Pure Git with Convention over Git solution to synchronize Git remote repositories.
Or how to live with Git remote repositories auto synchronized by it.

But consider to use git-sinc, the next generation of remote Git repositories synchronization.

How to work with the Convention over Git

Use Git, as you always do, except for the following.
  • Name branches and tags with a prefix of your side (as an example "company/some_branch_name").
  • Do plain commits to prefixed branches of your side.
  • Delete only branches and tags of your side. Deleted by you refs from other sides will be recreated automatically.

How to migrate your work to another side refs

All refs will be updated on all sides automatically.
But when you will want to migrate your work to another side, you will do one of the following.
By a merge or cherry-pick from your side
  1. Do a plain merge from you prefixed branch to a prefixed branch of another side.
  2. After a synchronization interval do "git fetch" and check your merge-commit is still there.
  3. If not, then just repeat everything.
This is not a problem, really. Your local Git repository always preserves all local branches (it even stores deleted commits in the Git's reflog).

Commits between different sides may disappear if somebody else do a "git push" to the same branch before you.
There is an auto conflict resolving that deletes your merge-commit only in a case of non-fast-forward differences. This is not so often.

By a merge or cherry-pick at another side.
Nobody doing so :-)
This works if your can connect to a remote Git repository of the other side.
Wait the sin—Āhronization interval and your commits will appear on the remote repository of the other side.
Do a merge between branches there.
Now this is safe. No checks, no worries. Done.

By a plain commit on your side to an other side ref.
Junior developers doing so. Prevent this.
If you feel lucky you can do a plain commit directly to a branch of the other side.
Again, you must recheck you commit is still there after a synchronization interval.
And if you're unlucky then you'll end up searching your commit in the Git-reflog. It is time wasting operation. I warned you.
So, be careful or inform guys on the other side.

Out of convention refs

In the provided implementation mode of the Convention over Git, the sides only see conventional (prefixed) refs.
Not-prefixed branches and tags will stay undisclosed for other sides. They even can have the same names on different remote Git repositories.

Convention over Git = CoG

CoG or Convention over Git allows automated conflict solving during automated synchronization of remote Git repositories.

Naming convention

Convention over Git uses any naming convention that allows to define owners of each Git-branch.

As an example the prefixed names.
Each remote Git repository owns its prefix and all non-fast-forward conflicts will be solved in favor of a prefix owner.
company1/develop, company2-develop
company1/JIRA-123, company2-JIRA-321

So, the naming convention in Git can be any conventional separation of names

  • Some defined prefixes or suffixes on both repositories.
  • A slave repository can have a prefix and a master repository have nothing. I.e. all non conventional (non-prefixed) branches belongs to the master Git-repository
  • etc

Conventions over Git gives many advantages and drastically simplifies any implementation.
Possibly it is unclear at first glance, but it's worth it.

  • Please, do not migrate everything between repositories. It is absolutely not necessary and even harmful! CoG just allows to save your repositories in sanity.
  • GoG adds some level of self responsibility and implies some self management. You shouldn't control everything. Believe in your teams.
Ohh, lost my thoughts here. Possibly I'll continue later.