[git-users] How to push transtaled pro git book v2 to git-scm.com

2018-10-01 Thread Nguyễn Hùng
Hello guys
I am translating pro git book v2 into my language (vietnamese)
Pls show me how to push my project to git-scm.com
Thank you

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[git-users] Re: pre-pull hook?

2018-10-01 Thread B. Lachele Foley
Another way to look at this is:  

Git already has a sort of pre-merge hook in that it will not let you merge 
if there are un-committed changes in the repo.  

We are trying to do the same thing.  The difference is that the 
un-committed changes aren't something git can see, so we will never get the 
"Please commit your changes or stash them before you merge." message.  We 
are trying to do the equivalent of that - to keep people from merging if 
there are uncommitted changes (that should be) in the repo.  But, best I 
know, git will not consider a MariaDB table to be a part of its 'repo'.  
So, we need a hook.  We are fond of learning about this problem before the 
fetch happens, but it definitely has to happen pre-merge.



On Thursday, September 27, 2018 at 11:52:48 AM UTC-4, B. Lachele Foley 
wrote:
>
> Our group could really use a pre-pull hook.  Is there already a way to do 
> this?  I wrote a little wrapper script in bash for it, but that's not ideal.
>
> Here is our use case:
>
> The code in our repo is coupled to a database. We have made it so that all 
> the parts of the database that are controlled by developers are git-managed 
> within the repo.  However, it is often convenient or otherwise desirable 
> for the developer to edit the relevant database tables directly (in the 
> usual manner, by connecting to the DB server and using SQL commands,etc.).  
> But, if this happens, it is very important that the developer has dumped 
> the relevant data into the git-managed files and committed the changes 
> before pulling.  Doing this ensures that there will be a merge conflict if, 
> for example, two devs have modified the same row in the same table (a 
> legitimate possibility for us).
>
> The pre-pull hook we would write would do something like this:  It would 
> dump the relevant data to temporary files and compare them with the 
> git-managed versions.  If there are differences, a pull would not be 
> allowed until the dev has made the git-managed files match the contents of 
> their database.  
>
> I looked briefly at the source code for git.  I think I found where I 
> would need to put the new code, but also found that I would need to learn 
> many new things before making the change.  So, if I do it, there might be a 
> considerable wait.  Therefore, part 2 of this question is: does anyone know 
> who to ask about implementing this feature if there is not another way to 
> handle the situation?
>
> Thanks!
>
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] pre-pull hook?

2018-10-01 Thread B. Lachele Foley
I think that I have not properly communicated what we are doing and why we
are asking for this thing that seems irrational.

Before trying to do that, let me respond to a few other things.

If you had a pre-merge hook, then it would run even on local merges between
> branches.
>

This is where a pre-merge hook is a problem.  It will drive the devs nuts
every time they merge a local branch.

The "magic" of a fetch is simple: copies of objects in other repos wind up
> in your repo unaltered, and remote branch pointers are updated. In
> particular, there is no need for a fetch to be followed by a merge.

You can do a fetch any time you want to know "What is Alice doing now?".
>

Yes.  We all understand this.  I promise.  We know that a fetch is safe.
We know that it does not alter the local repo.

> We definitely want to avoid having different versions of
> merge/fetch/pull/etc. because we don't want the devs to have to remember to
> do the special thing.  Besides, we already have a special 'pull'.
>
> Umm ... why?
>

You might be asking one of two things:

*  Why do we have a special 'pull'?  I'll try to explain better below.

*  Why don't we want different versions?  Because we need a fail-safe, not
a safety procedure.  We already have a safety procedure (the special pull).

Which, now that I think about it, really means a post-merge check, not a
> pre-fetch check. Because remember, if you do a fetch, you're seeing what
> the other person has, including the other person's state of that shared
> updated data. Any changes to that shared updated data happens on your merge
> of their data.
>

This was the statement that made me certain that I had not explained well
enough.  A post-merge will not do.  Apologies for not explaining very
well.  Please read on.

We want a fail-safe that does these things:

* Happens in the course of normal work with no special or different dev
behavior.  So, it needs to be a hook and not a separate command.

* Adds as little overhead to the developer's job as possible (this is why
we don't want it on 'merge').

I find that this is not easy to explain.  Please say if anything seems not
to make sense.

Here is the setup:

Developer A has made changes to the data in the database, but *has not*
dumped the data to the file that is git-managed.

Developer B has made changes to the database data and *has* dumped the data
to the file.  Dev B commits the changes and pushes them up to the shared
repo.

Developer A gets distracted for a minute or a week and forgets about the
changes to the data.  Dev A fetches and merges the changes from Dev B.

At this point, we do not yet have a problem.  But, we probably will very
soon because one of these two things is likely to happen:

Situation 1:  Dev A loads the data from Dev B into the database,
potentially overwriting, in a non-recoverable way, the changes made by Dev
A.  If Dev A is lucky, Dev B was working on something else.  But... there
is no way to know because the data were not in git's purview.

Situation 2:  Dev A remembers about the data, but doesn't realize that Dev
B changed the data, and dumps it (A's data) to the git-managed data file,
overwriting Dev B's data.  This is a recoverable situation.  But, it could
be months before the problem is noticed, and at that point, it could take
many person-hours to find and fix it.

We want, and desperately need, for git to produce merge conflicts for this
data when there are colliding changes.  But, git cannot produce a merge
conflict if Dev A has not dumped the data to a file that git manages before
merging with the changes Dev B made.  So, we need to make sure that the
data is in git's graph before any merging happens.

We want a pre-fetch (or post-fetch) hook for these reasons:

* It conveniently targets only problems that might be introduced by
receiving data from *external* sources.  That is, it doesn't interfere with
local repo activities like merging branches.  We know that a fetch is
safe.  But, a fetch happens to be special in that it is a *fetch*.  So,
before I fetch, I want to make sure that I'm in a state where receiving
external data is safe.  In other words, if my house isn't in order, there's
no point inviting guests.   A post-fetch hook is ok.  A pre-fetch hook just
saves the time waiting for the fetch to complete before finding out that
you still have housework to do.  To say that another way: what is in the
fetch is not the problem.  The problem is what isn't yet in the local repo.

* It does this without making the dev have to remember to run a separate
script or manually inspect the changes coming in.

* it tries to prevent the dev from having to revert commits or dig through
histories, etc.

* It stays as much as possible out of the way of other normal activities.
This is, as I said, why a pre-merge hook isn't preferred.

Our special 'pull' just checks to be sure that the data in the git-managed
files matches the corresponding data in the database.  If it does not, the
dev is