Git: how to push without checking?

I have two computers A and B and use git to synchronize some files, for example init.el. Repositories are hosted on inaction. B - locally.

  • init.el is changed and pressed.
  • init.el in B is also changed.

The question arises: how to combine the changes from A to B and output the final init.el to unuddle (A), without the A extension of the entire file in B.

Or is there a better solution?

Thanks.

+4
source share
3 answers

So, if you do not want to pull out files modified in A , you can do like this:

In B create a new branch and push it to the remote service (no change, as you said):

 cd path/to/init.el git branch featureModifiedInB git checkout featureModifiedInB git push origin featureModifiedInB 

In A pull out the branch update created in B , manage merge and conflict:

 cd path/to/init.el git pull origin featureModifiedInB // Or you can do fetch and manually do merging. git checkout master git merge featureModifiedInB // After solve the conflict if it exists. git push origin master 

It ensures that the person using B cannot see the files that are edited by the person who uses A But this will cause a problem: pB cannot get feedback about the code that it created. But pA can also change the featureModifiedInB branch and let it pull out pB (mom ... a little troublesome ..).

+2
source

There are several options:

  • If you do not want to save changes to A, git push -f origin master . Please note that pressing force will cause some problems for everyone who depends on you and wants to unite.
  • Soft reset to last common commit between A and B, git stash , pull, merge, open cache (merge delay with current code), commit and click. If someone separates from you after this general commit, they cannot easily merge back, if at all.
0
source

If A and B are not completely connected (as you say "Files don’t know about B files and vice versa"), you do not need to combine them. Just press A and B and do not combine them.

If you want more separation, create another repository to host your work in B. Use unuddle to allow / deny access.

0
source

Source: https://habr.com/ru/post/1388560/


All Articles