Locking commit in git - lock option

Asked

Viewed 1,046 times

1

I’m tasked with deploying a versioning system here at the company. However I am in doubt between SVN and Git.

My question is whether git has something that does the same as git lock of the SVN, that is, that blocks the commit of some certain files for certain branch.

what I would have is '3 branchs' fixed:

  • Master: where the main application is.
  • Homologation: where it waits for the client to test and homologate.
  • Testing: where is a "final" version of the program version, for intensive testing by teams.

then there are the developments.

However in these 3 branchs, they have some settings files (such as database, FTP, etc) that should not pass to each other branch.
So I’d like, to avoid human error, to block the merge/commit of those files among the branchs and would like to know if git has how to do(or would have some other that allows).

  • I don’t know if it’s the best solution, but you can use a file called . gitignore that prevents files or folders from being sent to Git

  • the problem is that then these files would not go to the server/repositorio...

  • 3

    Look, the SVN lock, it’s not quite what you need. SVN lock is per user. You "Locka" the file, to prevent someone else from committing before you, that’s all. What you need is to work with the permissions file, and that has both Git and SVN. If you can choose, it goes from Git.

  • I’m not sure I understand your use case. See, if you block the merge/commit of a versioned file, how will you send it to the server when it actually needs to be changed? Manually. Now, will you always copy in your hand, so that you can copy along with everything else, especially when it comes to sensitive data? Easier to keep ignored.

  • Victor Tadashi, how do we do it? There are the steps?

  • Ricardo, first of all for the main reason of Versionar: to have versions/history of the file. Second would only be some users who could alter these files because of responsibility and not run the risk of commits mistake

Show 1 more comment

1 answer

2

Ignoring part of its structure of branchs which may be a separate discussion, what you are needing is something quite different from the solution you are thinking about. You need a Continous Integration and Continous Deploy process.

Why do I say that? First because it is currently crucial that your Deploys run in an automated manner, eliminating possible operational errors, secondly, you have variables that change according to the deployment environment, and who are sensitive, and it is not anyone who can have access.

What I suggest to you is to use a Tool like Visual Studio Team Services (VSTS) to manage your projects. There, in addition to having a GIT repository for version control, you have the process of build automatic and also Deploy automatic.

In the Deploy process, you can configure your environments as Dev, Homologation, production, etc, and embed in these environments this sensitive data in an encrypted way, also ensuring security throughout the process.

If you want to know more about VSTS, watch that playlist.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.