Use Git with existing files and update branch after push

前端 未结 2 1847
天涯浪人
天涯浪人 2021-01-28 01:16

we are currently starting to work with Git and run into some trouble.

Baiscally what i want is to have a Git-Repository that users can push to and pull from.

Als

相关标签:
2条回答
  • 2021-01-28 01:38

    You must not push to a non bare repository! You cannot push to a checked out branch!

    Now given you situation my suggestion is:

    Keep a blessed bare repository! Do all your development on the local, merge/rebase on master and then push to blessed bare.

    You can write the post-receive hook of the blessed bare that it has a code/runs a script that has code to cd into your production repo, and pull from blessed bare.(it will be a fast-forward as you might have resolved conflicts before pushing to blessed bare)

    This way, on every push to 'blessed bare', you pull into the production and update the checked out master!

    Hope this solves the problem.

    Happy gitting!

    0 讨论(0)
  • 2021-01-28 01:43

    Based on what you have described, then I think implementing the branching strategy known as GitFlow might work for you.

    0 讨论(0)
提交回复
热议问题