Re: [git-users] Retrieve all files of a group of projects as they were at a given date

2019-05-24 Thread Michael


On 2019-05-16, at 11:35 AM, Giorgio Forti  wrote:

> If I commit ONE file Git builds a "zip" that contains the actual situation of 
> ALL the 6 thousand of files in my C# solution? 
> And if I check out this commithe file Git gives me back the complete 
> situation at that moment?
> This would be the solution.
> This can work with files committed only locally and not pushed to the remote 
> repository?

So let me explain, if I can, the cheat that git uses.

Git's internal backing store is a write-once file system. Once a file goes into 
the "filesystem", it never changes. Since it never changes, the true internal 
name is the hash of the file.

Elsewhere, there are maps of user-visible-filenames to hash-filenames. And 
those maps are also files inside git's file system, and they have a 
hash-filename.

Please re-read those two bits twice more.

Alright, so what git does is this:
1. At any given moment, the "index" or "cache" contains the state of "what will 
be checked in next" -- and it consists of a full set of filename to hashname 
maps for the entire project.
2. On any given commit, the vast majority of files will not change, so the 
actual commit will have the same filename to hashname map as the last commit.
3. The actual commit is NOT the set of files, but the set of filename to 
hashname maps.

Please re-read number 3 there.

Git will store lots and lots of junk files over time. There is a separate 
mechanism that goes  through and finds all hash-filename files that are not 
referenced from any of the commit lists of user-filename to hash-filename maps, 
and cleans those out.

Git does not build a zip of all the 6000 files in your commit.
It builds a "zip" of the mappings of user-filenames to hash-filenames.

And, since this is a tree structure, ** if a directory does not change, it is 
reusing the same directory user filename to git-hash-filename map **.

The result is that when you change one file, all that changes is the directory 
object for the directory containing the filename of that object (because the 
user-filename now points to a different hash-filename), and all the parent 
directories back up to the root.

This is what makes git fast.

When you say "git add filename", the new file has been added to git's 
write-once backing store. And, the filename to hashname map in the index/cache 
has been updated.

That's one copy, one hash calculation, and one updating of a 40 byte hash 
record in a file. Plus possibly updating hash calculations and data for each 
parent directory.

After that, it's just a case of recording which new hash number is in use in 
various places.

This is git's cheat. It's just relying on unchanging hashes that have been 
mostly calculated in the past and are cheap to copy from A to B.

> I definitely recommend to learn about "git rebase -i" because you probably 
> will need it in near future. Git cherry-pick may help, too, if you are not 
> ready to learn about rebasing.

If you are looking to have to do a big, massive merge, which it sounds like ...

You will want to look into a tool called "imerge".  Git-imerge is a program 
that tries to solve the "massive merge" problem. It breaks the merge down into 
many, many, many little merges, most of which are automatic, and a tiny few 
will need your help with.

It makes the giant merge much less painful. Not pain-free. Less painful.

iMerge operates in two passes. Pass one does the merge, and absolutely clutters 
the history.
Pass 2 cleans up the history, and gives you a choice of either "This looks like 
a normal rebase", "This looks like a normal merge", or "This looks like a 
rebase, but keeps the history of how the changes were made". This last option 
*should* be the best choice, but at the moment it isn't. It leaves you with two 
sets of "history links" -- one set important, one set unimportant -- and there 
is no way to indicate to git which is which, and no tools to say "don't show 
these links by default". The result is that your history will look very messy, 
because the existing tools make assumptions that this system breaks.

---
This message was composed with the aid of a laptop cat, and no mouse

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/079FDC79-DB83-408A-960B-0D1C9B4AF87A%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


[git-users] Merging a file that is different between two branches

2019-05-24 Thread Ravi Malghan
I have 2 branches: devl, acpt. Typically all the users make changes in the 
devl and when ready to deploy merge it to acpt. At some point someone must 
have done something which made a file different in the branches. running a 
git merge in acpt branch from devl doesn't seem to be merging the file from 
devl branch to acpt. 

>git status
>
> On branch acpt
>
> Your branch is up-to-date with 'origin/acpt'.
>
> nothing to commit, working tree clean
>
> >git diff --name-only devl acpt
>
> etc/system.js
>
>
 I want to merge this file from devl to acpt branch. git merge doesn't seem 
to be doing. Can someone help

> >git merge devl
>
> Merge made by the 'recursive' strategy.
>
> > git diff --name-only devl acpt
>
> etc/system.js
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/661253f0-6d4e-4bf1-89cc-9587541b8a02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[git-users] Re: delete files from git history but failed

2019-05-24 Thread JiaYu Zhang
I found that repeat the delete command does the work, who could tell me why?

git clone g...@github.com:rawbin-/git-rewrite-history-test.git
cd git-rewrite-history-test
git rev-list --objects --all  ## show objects 
git filter-branch -f --index-filter 'git rm -rf --cached --ignore-unmatch 
dist*.zip  dist' --prune-empty --tag-name-filter cat -- --all
git rev-list --objects --all  ## the dist and dist.zip are still there
git filter-branch -f --index-filter 'git rm -rf --cached --ignore-unmatch 
dist*.zip  dist' --prune-empty --tag-name-filter cat -- --all
git rev-list --objects --all  ## the dist and dist.zip have gone



在 2019年5月24日星期五 UTC+8下午3:10:43,JiaYu Zhang写道:
>
> I want to delete dist and dist.zip from the git history, with the 
> following commands,but failed
>
>
> git clone g...@github.com:rawbin-/git-rewrite-history-test.git
> cd git-rewrite-history-test
> git rev-list --objects --all  ## show objects 
> git filter-branch -f --index-filter 'git rm -rf --cached --ignore-unmatch 
> dist*.zip  dist' --prune-empty --tag-name-filter cat -- --all
> git reflog expire --expire=now --expire-unreachable=all --all
> git fsck --full --unreachable
> git repack -A -d
> git gc --prune=now --aggressive
> git rev-list --objects --all  ## the objects are still there
>
>
>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/93c23a3d-d946-4af3-a8d8-dcf1360a04df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[git-users] delete files from git history but failed

2019-05-24 Thread JiaYu Zhang
I want to delete dist and dist.zip from the git history, with the following 
commands,but failed


git clone g...@github.com:rawbin-/git-rewrite-history-test.git
cd git-rewrite-history-test
git rev-list --objects --all  ## show objects 
git filter-branch -f --index-filter 'git rm -rf --cached --ignore-unmatch 
dist*.zip  dist' --prune-empty --tag-name-filter cat -- --all
git reflog expire --expire=now --expire-unreachable=all --all
git fsck --full --unreachable
git repack -A -d
git gc --prune=now --aggressive
git rev-list --objects --all  ## the objects are still there




-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/3e1d1319-c65d-4846-bace-933d748624f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.