Re: [git-users] How do I check out a remote git?

2015-02-25 Thread Michael

On 2015-02-24, at 10:40 PM, Gergely Polonkai gerg...@polonkai.eu wrote:

 Hello,
 
 yes, basically that is the way. There is an option in recent Git called 
 shallow clone, which doesn't clone the whole history, only the last N 
 commits. You can also specify the branch name you want to use instead of 
 master, so using these two, you will actually get what you want.
 
Alright, so what is the actual syntax?

Also: the last N commits? Not the current state of the branch? ...

What if there's one file in the directory that has not been changed in two 
years -- would that mean fetching two years worth of history to retrieve the 
current state of things?

...

-- 
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] How do I check out a remote git?

2015-02-25 Thread Gergely Polonkai
For shallow clones, you can use the --depth parameter, and for the branch,
well, --branch. For more fine grained options you should consult the
git-init manpage, which may present you other useful switches.

For the last N commit part: N can be any positive integer, including one.
This makes it possible to get an actual snapshot of the given branch. Which
leads directly to your other question.

Git stores a directory tree snapshot with every commit, and this directory
tree references files (blobs in Git terminology). Whenever you change a
file's contents the corresponding blob changes and with it, naturally, the
whole tree, and this new tree will be saved with your next commit.

Now if you don't change a file through 200 commits, that means the
corresponding blob reference in all your trees remains unchanged. Thus, you
will get the same blob (the file's contents) in the last commit as you did
200 commits before.

When you make a shallow clone, Git will fetch the tree of the last N
commits (N is what you specified after --depth), and all the referenced
blobs. However, as that old blob is referenced by both the old and new
trees, you don't have to fetch 200 commits, just the last few (N). (Note
that technically a bit different things happen in the background; but in
the end you will get only those last N commits.) For more information on
this subject, I suggest to read an article/book on Git's internals (like
[1]) and shallow clones (like [2]).

Best,
Gergely

[1] http://git-scm.com/book/en/v1/Git-Internals
[2]
http://strk.keybit.net/blog/2011/06/07/getting-just-the-tip-of-a-remote-git-branch/
On 25 Feb 2015 19:42, Michael keybou...@gmail.com wrote:


 On 2015-02-24, at 10:40 PM, Gergely Polonkai gerg...@polonkai.eu wrote:

 Hello,

 yes, basically that is the way. There is an option in recent Git called
 shallow clone, which doesn't clone the whole history, only the last N
 commits. You can also specify the branch name you want to use instead of
 master, so using these two, you will actually get what you want.

 Alright, so what is the actual syntax?

 Also: the last N commits? Not the current state of the branch? ...

 What if there's one file in the directory that has not been changed in two
 years -- would that mean fetching two years worth of history to retrieve
 the current state of things?

 ...

  --
 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.


-- 
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] How do I undo a merge?

2015-02-25 Thread Michael

On 2015-02-22, at 9:04 PM, Nicolas Dermine nicolas.derm...@gmail.com wrote:

 Hi Michael,
 
 On Mon, Feb 23, 2015 at 2:17 AM, Michael keybou...@gmail.com wrote:
 So a quick question: How do I undo/abort a merge?
 
 I am learning, and experimenting. I was experimenting with git merge, 
 forgot the --no-commit, and discovered the hard way that aborting the 
 editor that comes up without saving does NOT abort the merge.
 
 And git merge --abort fails, because the merge succeeded.
 
 Git Gui has a way to amend the comment of the last merge, but no way to undo 
 it.
 I figure this should be simple, but I don't know how.
 
 One way to do that :
 - look up the hash of the commit you want to go back to, let's say
 it's 'abc1234'
 - run `git reset --hard abc1234`.

Ok. Now, can you help me fix my remote as well?

keybounceMBP:2aec26bc01189ea4b310 michael$ git checkout master
Previous HEAD position was 7ed0130... 
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.

keybounceMBP:2aec26bc01189ea4b310 michael$ git reset HEAD^

keybounceMBP:2aec26bc01189ea4b310 michael$ git push --all
Username for 'https://gist.github.com': keybounce
Password for 'https://keybou...@gist.github.com': 
To https://gist.github.com/5e037df5b5c9209885d5.git
 ! [rejected]master - master (non-fast-forward)
error: failed to push some refs to 
'https://gist.github.com/5e037df5b5c9209885d5.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
keybounceMBP:2aec26bc01189ea4b310 michael$ 


-- 
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: Folder not under version control but changing upon change of branch?

2015-02-25 Thread Rainer M Krug
But I actually would like to have them in the master branch, as these 
should include thee complete analysis, including source code, input data, 
output data and resulting images and report - so including the ./output and 
./cache directories.

Is this possible somehow?

Rainer


On Monday, February 23, 2015 at 1:41:23 PM UTC+1, dav...@the-aim.be wrote:

 It might be an idea to not store them in any of your branches. Meaning the 
 files are untracked in neither of your branches. (using git rm --cached 
 FILENAMES)
 This way when checking out master or dev the files are always there and 
 will never be overwritten in any case because they belong to neither branch.

 Could this be the way to go for you?

 David

 On Friday, February 20, 2015 at 11:39:28 AM UTC+1, Rainer M Krug wrote:

 Hi

 I have two brances, one master and one dev.

 I have two directories with results (./output and ./cache) from an 
 analysis. As these are quite big files, I do not want to have them in my 
 dev branch, but would like to have them in my master branch, as I have 
 there my different stages og=f the analysis which should contain the source 
 code as well as the binary results.

 So far so good - I have .gitignore under git, so that in the dev btanch, 
 .gitignore contains the two directories, i.e. they are excluded, while the 
 .gitignore in the master branch does not contain these directories, sdo 
 they are not ignored but submitted.

 Now my problem and question: 

 When I am in dev and do ```git checkout master``` is the content of the 
 ./cache and ./output folders silently overwritten or am I warned that it 
 will be overwritten?

 going the other direction, i.e. being on master and doing ```git checkout 
 dev``` the files in ./cache and ./output are not restored to their original 
 dev versions. 

 I guess I could stash these before switching branches, but is there an 
 easier (read: more automated so that I do not forget to do it) way of 
 achieving this?

 I assume that this might be a more common scenario?

 Thanks,

 Rainer



-- 
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: Fwd: [git-users] How to use git to store large files without keeping track of versions?

2015-02-25 Thread Magnus Therning
On Tue, Feb 24, 2015 at 12:06:38PM -0600, Peng Yu wrote:
 I forget to send to the mailing list.
 
 
 -- Forwarded message --
 From: Peng Yu pengyu...@gmail.com
 Date: Tue, Feb 24, 2015 at 12:05 PM
 Subject: Re: [git-users] How to use git to store large files without
 keeping track of versions?
 To: Konstantin Khomoutov flatw...@users.sourceforge.net
 
 
 On Tue, Feb 24, 2015 at 7:45 AM, Konstantin Khomoutov
 flatw...@users.sourceforge.net wrote:
  On Sun, 22 Feb 2015 07:51:59 -0800 (PST)
  pengyu...@gmail.com wrote:
 
  I have some data files that need to be stored along with source code.
  These data files are large, but I don't need to keep their versions.
  I only need to keep the versions of the source code.
 
  git-annex is mainly for large files with versioning. Therefore, it is
  not suitable for my situation.
 
  Does anybody know whether there is a way to use git to manage source
  code (with versioning) as well data files (without versioning)?
 
  It's a bit unclear what you are really asking for.
 
  Are you fine with keeping those files checked into your repository and
  are just afraid each commit will somehow include those file into the
  repository again and again (many guides state that with each commit Git
  stores snapshots, not deltas)?  If so, then fear not: while Git indeed
  stores snapshots, the content which did not change will not be
  somehow included again -- the new commit will reference existing
  objects representing those big files.  So, just add and commit these
  files once and just make sure you don't change them and commit these
  changes.
 
 In my git repository, there are data files as well as source files.
 For source files, they can be stored with the regular git mechanisms.
 The problem is that data files (many of them, each one many MBs). They
 stored in gz files, they can not be effectively diffed as the content
 of the data can be completely changed. Also, old data files can not be
 permanently deleted from the .git directory, even they are not
 available in the most recent commit. This is can be unacceptable
 situation, as the git reposiotry will quickly grow to a size that is
 slow to use.
 
 Is it clear what my scenario is?

I think git-annex *is* solving exactly this problem!

If you have played with git-annex, would you please explain why it
isn't what you are looking for?

/M

-- 
Magnus Therning  OpenPGP: 0xAB4DFBA4 
email: mag...@therning.org   jabber: mag...@therning.org
twitter: magthe   http://therning.org/magnus

You know, take Lisp. You know, it’s the most beautiful language in the
world. At least up until Haskell came along.
 -- Larry Wall

-- 
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.


pgpaK2a9qK1CD.pgp
Description: PGP signature


Re: [git-users] Single Branch repository has objects from other branches

2015-02-25 Thread Phillip Lord

Sorry for slow reply -- my subscription settings were not what I thought!

It's difficult for me to say as I was not actively tracking my use of the 
repository, but I did use it during that period. I certainly pulled and 
pushed, probably to both of the two remotes that it has. The objects do 
come from one of the remotes, but are on a different branch, which I didn't 
pull.



On Friday, 13 February 2015 06:33:22 UTC, Gergely Polonkai wrote:

 Hello,

 I'm curious what you did during that ”Over time” period. Did you 
 pull/fetch from the remote? If so, there is a big chance that it copied 
 things from there.

 Best,
 Gergely
 On 13 Feb 2015 04:28, Phillip Lord philli...@newcastle.ac.uk 
 javascript: wrote:



 I have made a single branch clone of a repository. Originally, it was
 around 2Mb in size (compared to about 150Mb for a normal clone). Over
 time, though it has grown to around 20Mb.

 I've used a script that I found here...


 https://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/

 To attempt to find out why. And it appears that there are many objects
 NOT from the branch I cloned.

 There are a couple of possibilities.

 1) I messed something up with the clone -- a fresh single-branch clone
 of the repo is again 2Mb.

 2) I messed something up at some point later.

 3) This is expected behaviour.

 I'm not sure how to distinguish these. I could delete my repo and start
 another single-branch clone, but I don't want to do this if I have to
 end up doing the same again.

 Any advice is welcome.

 Phil

 --
 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+...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/d/optout.



-- 
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] Single Branch repository has objects from other branches

2015-02-25 Thread Phillip Lord


On Monday, 16 February 2015 03:21:20 UTC, Dale Worley wrote:

 philli...@newcastle.ac.uk javascript: (Phillip Lord) writes: 
  I have made a single branch clone of a repository. Originally, it was 
  around 2Mb in size (compared to about 150Mb for a normal clone). Over 
  time, though it has grown to around 20Mb. 
  
  I've used a script that I found here... 
  
  
 https://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
  
  
  To attempt to find out why. And it appears that there are many objects 
  NOT from the branch I cloned. 

 What are the objects?  Their contents can probably tell you a great deal 
 about what sort of commit referenced them. 
   


They are objects from a different branch. The big ones are binary or 
generated documentation, which probably shouldn't have been there anyway. 

The repository is, essentially, using persistent branches to host different 
projects. My branch is never intended to be merged with master, and 
contains only the files that I need.
 

-- 
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.