Automatic Commit for uncommitted code

edgardavidp February 14, 2019

Based on this question

Pull-Uncommited-Changes-on-Remote-Machine

Would it be worth it to have such functionality to prevent missing codes?

 

3 comments

Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 14, 2019

The thing about uncommitted changes is that it is only your local copy of the repository that knows about it. And Git does not keep track of how has create a clone of a repository. So in order to be able to bring in uncommitted changes from another clone you would need to change the default behavior of Git so it store information on where each clone is. I believe that is what Linus and the gang wanted to get away from when they came up with Git.

edgardavidp February 14, 2019

But what about a setting to upload local uncommited changes to a remote branch. Idk like check points or something. This would be sourcetree only function

Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 15, 2019

So you are looking for a function that automatically commits and push your code changes on a time interval? What would you do in a situation where incomplete changes are pushed out? I am not sure that such a function would be well received. I can only speak for the developers in my company and most of them would be against it. From time to time they add code just to test something out, but have no intention to have it added to the code base or make it available for others. So with an automatic sync that code would be pushed up and be available. 

Lets say that you are not using Bitbucket or Github as a centralized storage, and/or you have multiple remotes, should the automatic sync push it to all those remotes? Or just a subset?

edgardavidp February 15, 2019

Basically a subset, a stash probably? See my the comment i posted, i thought i had replied, turns out i just posted a New comment

edgardavidp February 15, 2019

It would be automática but it would commit to a different branch Just to save the code.

We have had people leave the company that published a New versión of an application without committing changes.

It isnt until the next change that we realizen the code on the repo does not have the Last changes incorporated. 

Say you have your local copy, instead of coommiting automatically to Its remote, it would commit the uncommitted changes to a different branch. But keeping track to Its remote, everything would be the same. We would Just give others access to see the code changes on my local copies.

Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 15, 2019

So instead of the default Git behavior where there is a one-to-one relationship between your local branch and the remote (in most cases), you want a one-to-two relationship? Like if you are working on lets say my-branch and you push your changes to origin/my-branch, the auto-sync would also push your changes to origin/my-branch-auto?

The situation you described where a developer released a new version without committing his/her changes, I would say that is a broken development process. Why would a developer have direct access to push uncommitted code to a production environment, and without at least a code review?

edgardavidp February 15, 2019

It is indeed a broken process, but Its causing us rework. I would think we are not the only ones with the problem. 

It would still be a 1 to 1 relationship, the automátic commit would go to a different untracked branch, Just for consultation.

I think im not quite explaining myself

Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 15, 2019

I agree, you are not the only one with this problem, I have seen plenty of broken processes and developers that goes rogue to bypass a process. 

I think I know what you are looking for, and it can be done, but I also believe it would just hide the real issue. We have a similar situation, where dev teams think that they can fix a broken process by "fixing" the tool instead.

edgardavidp February 15, 2019

This is actually my last Resort. Im totally against it as this is just discipline

Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 15, 2019

I totally understand. The only immediate option I can think of would be either a backup solution on each client (that is what we tried when we first migrated to Git/Bitbucket, we later decided that developers have to push as part of their commit) or a scheduled job on each client that runs a script that checks the repository for uncommitted code and if it finds it, commits it and merge it to a untracked remote branch. 

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events