Re: [git-users] Rebasing tags

2012-08-17 Thread Andrew Gavin
On Thursday, 16 August 2012 00:20:00 UTC+1, Adam Prescott wrote:

 On Wed, Aug 15, 2012 at 11:57 PM, Andrew Gavin 
 axg...@googlemail.comjavascript:
  wrote:

 I would like to reliably carry over the tags from the fetch branches to 
 the respective branches that I'm going to dcommit.  I thought I could do a 
 rev-list checking the tree-hash of the commit and making sure that they are 
 the same for the commit on the fetch-line with the one on the branch I'm 
 rebasing onto.  But for some reasons, git svn might be part of it, this 
 isn't reliable.

 How can I determine which commits correspond to the tagged commits on the 
 fetch branch (I'm doing a manual rebase -onto at the moment)? Or even 
 perform a rebase where the tags get copied across? 


 How unique are the commit messages? I hope I've got the right idea of what 
 you want, but how about looking at a combination of commit message + author 
 email, perhaps ignoring commits reachable from, say, $(git merge-base 
 feature-branch master)?


Thanks Adam, but the commit messages+author are not always unique. I was 
hoping there would be a better way of tracking the commit through the 
rebase: so it wouldn't occasionally break down because commits looked the 
same.  Also svn dcommit adds more information to the message: opening 
another opportunity for bugs to creep in.

I'm going to have to have a play with merge-base, but in this case the two 
branches have no common ancestry (I think)... does merge-base operate on 
the commit hashes?

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/git-users/-/Fx6IUB9T8SUJ.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



[git-users] Re: Rebasing tags

2012-08-17 Thread Andrew Gavin
On Thursday, 16 August 2012 09:28:52 UTC+1, Thomas Ferris Nicolaisen wrote:


 On Thursday, August 16, 2012 12:57:47 AM UTC+2, Andrew Gavin wrote:

 I'm new to the group but have been using git for a while.  I have a 
 question about rebasing and tags.  We have a bridge which we use to bridge 
 a svn repository with a git repository using a script that is run on a 
 regular basis.  This bridging script fetches changes from a remote git 
 repository and rebases each fetch-head in turn onto the svn branch.

 I would like to reliably carry over the tags from the fetch branches to 
 the respective branches that I'm going to dcommit.  I thought I could do a 
 rev-list checking the tree-hash of the commit and making sure that they are 
 the same for the commit on the fetch-line with the one on the branch I'm 
 rebasing onto.  But for some reasons, git svn might be part of it, this 
 isn't reliable.

 How can I determine which commits correspond to the tagged commits on the 
 fetch branch (I'm doing a manual rebase -onto at the moment)? Or even 
 perform a rebase where the tags get copied across? 

 Is there an easier way that getting deeper into the rebase command itself?



 This sounds to me like a good idea that hasn't been implemented in git. 
 Kinda like --preserve-merges, there could be be a --preserve-tags in the 
 rebase command.

 However, there is no such thing. A tag is an alias for a SHA, and when the 
 SHA is rewritten, the tag is pointing at something else. Annoyingly correct 
 :)

 What I would do is to use something else than tags for this purpose. You 
 know how Gerrit recognizes commits across rebasing through their 
 Change-Idhttp://gerrit.googlecode.com/svn/documentation/2.0/user-changeid.html?
  
 Upon committing, a unique id is generated and noted in the commit message, 
 and this is used to recognize that one commits is the same as another after 
 it has been rewritten during code-review.

 I would just blatantly copy Gerrit's Change-id commit 
 hookhttps://gerrit.googlesource.com/gerrit/+/master/gerrit-server/src/main/resources/com/google/gerrit/server/tools/root/hooks/commit-msg,
  
 and go from there. Note that they generate this id for all commits, not 
 just the tagged ones like you want (maybe you can adapt the commit hook for 
 your own purposes, and build something on top that creates tags from these 
 ID's).


Thomas very interesting idea, thanks.  I'll have a play with the hook.

I note there was a patch for --preserve-tags that doesn't seem to have made 
it into git.  Probably for the reason you said (tag is an alias for a sha). 
 
http://article.gmane.org/gmane.comp.version-control.git/79433/match=preserve+tags
It did make me think of rolling a version of rebase in the bridge. 

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/git-users/-/cXZCyx2gKmAJ.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



[git-users] execute hooks for submodules from global templates

2012-08-17 Thread Fred
Hello,

I've defined a pre-commit hook in ~/.git_templates directory. It works 
great for all my git projects, except for submodules. If i do a commit in 
submodule directory pre-commit hook ist not executed. Is there a workaround?

Fred

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/git-users/-/XrjPwsjJ0C4J.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



[git-users] Full Backup - Best Practice

2012-08-17 Thread Michal Idziorek
Hello, 

What would be the most elegant way to fully backup a bare git repository. 

Would the following approach work fine?

tar -cf repository.tar repository/

I wonder what happens if the repository is accessed during the backup?

Warm regards and thanks in advance,

michal

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/git-users/-/iWkeekxesxoJ.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



[git-users] Re: Full Backup - Best Practice

2012-08-17 Thread Thomas Ferris Nicolaisen
On Friday, August 17, 2012 10:52:54 AM UTC+2, Michal Idziorek wrote:

 Hello, 

 What would be the most elegant way to fully backup a bare git repository. 

 Would the following approach work fine?

 tar -cf repository.tar repository/

 I wonder what happens if the repository is accessed during the backup?


Safest way I guess is to clone it, as this will ensure consistency. 

If you clone it locally, you probably better use the --no-hardlink option 
to make sure it's a proper copy.

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/git-users/-/Nt8ocMwAch0J.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



[git-users] Re: execute hooks for submodules from global templates

2012-08-17 Thread Thomas Ferris Nicolaisen
On Friday, August 17, 2012 10:50:35 AM UTC+2, Fred wrote:

 Hello,

 I've defined a pre-commit hook in ~/.git_templates directory. It works 
 great for all my git projects, except for submodules. If i do a commit in 
 submodule directory pre-commit hook ist not executed. Is there a workaround?


You need to *re-initialize* or re-clone the repositories after setting the 
git template dir (see the TEMPLATE DIR section under git init --help). 
Templates are only copied in during repository initialization.

You can re-initialize a repository with git init. Unfortunately, this 
doesn't work so well for submodules, so I would suggest you re-clone, 
re-init and re-update the project with submodules. OR just manually copy in 
the template contents.

(If you *absolutely* want to re-initialize a submodule without cloning the 
base repository all over again, do something like cd git 
submodule;GIT_DIR=../.git/modules/[submodule] git init; and then edit the 
../.git/modules/[submodule]/config and change bare=true to false.)

Submodules also respect the template dir setting, so the hooks should pop 
up inside base-repo/.git/modules/[submodule]/hooks after initialization.

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/git-users/-/euMvyupKDt4J.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



Re: [git-users] Full Backup - Best Practice

2012-08-17 Thread Konstantin Khomoutov
On Fri, 17 Aug 2012 01:52:54 -0700 (PDT)
Michal Idziorek idzio...@gmail.com wrote:

 What would be the most elegant way to fully backup a bare git
 repository. 
 
 Would the following approach work fine?
 
 tar -cf repository.tar repository/
 
 I wonder what happens if the repository is accessed during the backup?
Bad things happen: a Git repository is a collection of files, so any
transation semantics are implemented using some sort of policy *by the
Git tools* (supposedly through the usage of lock files).
Hence the only sure way to back up a Git repository which is
online (can be accessed by Git clients for pushing any time) is to
use Git tools.

In my shop, we back up each Git repo on the main server to its mirror
bare repository on another box using a call to `git fetch`:

git fetch --quiet --prune repo '+refs/*:refs/*'

which essentially means bring everything the remote has, update
matching local things (overwrite, if necessary), then delete everything
the remote does not have anymore.

(In fact, the solution is more involved: we host our repos using
gitolite, and the backup script first fetches the list of repos it has
the read permissions for (nice feature of gitolite), then fetches from
each readable repo, initializing an appropriate local bare repo first,
if the remote repo is seen for the first time.)

Obviously, this backs the repositories up using another host and a
local network.  If you want to back up locally, there are at least two
solutions involving Git tools:
1) You can do the same fetching shown above, just using
   /path/to/the/repo or file:///path/to/the/repo
   URLs to specify the repository to back up.
2) Use `git bundle` which is essentially just a much smarter `tar -cf`
   with an added bonus that Git tools consider a bundle as a
   self-contained repository.

Yet another approach might be to just reverse the logic and move to
push approach for backups rather than pull: for instance, recent
versions of gitolite grown built-in mirroring support [1].  

1. http://sitaramc.github.com/gitolite/mirroring.html

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



Re: [git-users] Re: Full Backup - Best Practice

2012-08-17 Thread Pankaj Gupta
i would prefer git bundle create backup file --all --remotes

To unbundle use : git clone backup file to clone from it.

i also liked git bundle verify to verify the bundle.

-Pankaj

On Fri, Aug 17, 2012 at 2:32 PM, Thomas Ferris Nicolaisen
tfn...@gmail.comwrote:

 On Friday, August 17, 2012 10:52:54 AM UTC+2, Michal Idziorek wrote:

 Hello,

 What would be the most elegant way to fully backup a bare git repository.

 Would the following approach work fine?

 tar -cf repository.tar repository/

 I wonder what happens if the repository is accessed during the backup?


 Safest way I guess is to clone it, as this will ensure consistency.

 If you clone it locally, you probably better use the --no-hardlink option
 to make sure it's a proper copy.

 --
 You received this message because you are subscribed to the Google Groups
 Git for human beings group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/git-users/-/Nt8ocMwAch0J.

 To post to this group, send email to git-users@googlegroups.com.
 To unsubscribe from this group, send email to
 git-users+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/git-users?hl=en.


-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



[git-users] Re: execute hooks for submodules from global templates

2012-08-17 Thread Fred
Thanks! Re-clone helped

On Friday, August 17, 2012 12:13:59 PM UTC+2, Thomas Ferris Nicolaisen 
wrote:

 On Friday, August 17, 2012 10:50:35 AM UTC+2, Fred wrote:

 Hello,

 I've defined a pre-commit hook in ~/.git_templates directory. It works 
 great for all my git projects, except for submodules. If i do a commit in 
 submodule directory pre-commit hook ist not executed. Is there a workaround?


 You need to *re-initialize* or re-clone the repositories after setting 
 the git template dir (see the TEMPLATE DIR section under git init --help). 
 Templates are only copied in during repository initialization.

 You can re-initialize a repository with git init. Unfortunately, this 
 doesn't work so well for submodules, so I would suggest you re-clone, 
 re-init and re-update the project with submodules. OR just manually copy in 
 the template contents.

 (If you *absolutely* want to re-initialize a submodule without cloning 
 the base repository all over again, do something like cd git 
 submodule;GIT_DIR=../.git/modules/[submodule] git init; and then edit the 
 ../.git/modules/[submodule]/config and change bare=true to false.)

 Submodules also respect the template dir setting, so the hooks should pop 
 up inside base-repo/.git/modules/[submodule]/hooks after initialization.


-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/git-users/-/W-HHmZyp1gYJ.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



Re: [git-users] execute hooks for submodules from global templates

2012-08-17 Thread Pankaj Gupta
Not sure if i understood the problem...

did you use this command to clone:

git clone --template=templatedir --recursive-submodules sourcerepo

or something else? please share the exact command..

-Pankaj

On Fri, Aug 17, 2012 at 2:20 PM, Fred fredgarlo...@googlemail.com wrote:

 Hello,

 I've defined a pre-commit hook in ~/.git_templates directory. It works
 great for all my git projects, except for submodules. If i do a commit in
 submodule directory pre-commit hook ist not executed. Is there a workaround?

 Fred

 --
 You received this message because you are subscribed to the Google Groups
 Git for human beings group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/git-users/-/XrjPwsjJ0C4J.
 To post to this group, send email to git-users@googlegroups.com.
 To unsubscribe from this group, send email to
 git-users+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/git-users?hl=en.


-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



Re: [git-users] Full Backup - Best Practice

2012-08-17 Thread Adam Prescott
On Fri, Aug 17, 2012 at 11:43 AM, Konstantin Khomoutov 
flatw...@users.sourceforge.net wrote:

 In my shop, we back up each Git repo on the main server to its mirror
 bare repository on another box using a call to `git fetch`:

 git fetch --quiet --prune repo '+refs/*:refs/*'

 which essentially means bring everything the remote has, update
 matching local things (overwrite, if necessary), then delete everything
 the remote does not have anymore.


Aren't you just recreating `git clone --mirror`? If I remember, it will
automatically prune any deleted refs on the next fetch.

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



Re: [git-users] Full Backup - Best Practice

2012-08-17 Thread Konstantin Khomoutov
On Fri, 17 Aug 2012 13:20:17 +0100
Adam Prescott a...@aprescott.com wrote:

  In my shop, we back up each Git repo on the main server to its
  mirror bare repository on another box using a call to `git fetch`:
 
  git fetch --quiet --prune repo '+refs/*:refs/*'
 
  which essentially means bring everything the remote has, update
  matching local things (overwrite, if necessary), then delete
  everything the remote does not have anymore.
 
 Aren't you just recreating `git clone --mirror`? If I remember, it
 will automatically prune any deleted refs on the next fetch.
Quite probably.  The problem with `git clone` is that it's supposed to
create a repository, but we keep the mirror repositories around
(I mean, they are not tarred and gzipped, and just sit there waiting
for the next backup round or for being used for disaster recovery).

The upside of this approach is that it minimizes transfers because they
become differential, and this allows to backup often, without worrying
too much about load spikes on the server and the network.

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



Re: [git-users] execute hooks for submodules from global templates

2012-08-17 Thread Fred

just

git clone --recursive sourcerepo


in my  config ~/.gitconfig I've added

[init]
templatedir = ~/.git_template


On Friday, August 17, 2012 2:10:35 PM UTC+2, Pankaj Gupta wrote:

 Not sure if i understood the problem...

 did you use this command to clone:

 git clone --template=templatedir --recursive-submodules sourcerepo

 or something else? please share the exact command..

 -Pankaj

 On Fri, Aug 17, 2012 at 2:20 PM, Fred fredga...@googlemail.comjavascript:
  wrote:

 Hello,

 I've defined a pre-commit hook in ~/.git_templates directory. It works 
 great for all my git projects, except for submodules. If i do a commit in 
 submodule directory pre-commit hook ist not executed. Is there a workaround?

 Fred

 -- 
 You received this message because you are subscribed to the Google Groups 
 Git for human beings group.
 To view this discussion on the web visit 
 https://groups.google.com/d/msg/git-users/-/XrjPwsjJ0C4J.
 To post to this group, send email to git-...@googlegroups.comjavascript:
 .
 To unsubscribe from this group, send email to 
 git-users+...@googlegroups.com javascript:.
 For more options, visit this group at 
 http://groups.google.com/group/git-users?hl=en.




-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/git-users/-/TjmdSnTd7q8J.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



[git-users] Warning: you are leaving 30 commits behind, not connected to any of your branches:

2012-08-17 Thread Fred
Hello,

I've cloned a fresh repo with submodules and then cd library/module  git 
checkout master

it gives me a warning and I don't understand why and how to avoid it? 

Warning: you are leaving 30 commits behind, not connected to
any of your branches:

  2553655 Merge branch 'master' into prod
  6b07300 Fix build
 ... and 28 more.

If you want to keep them by creating a new branch, this may be a good time
to do so with:

 git branch new_branch_name 654646464

Branch master set up to track remote branch master from origin.
Switched to a new branch 'master'


What is going wrong here? How did we managed to have commits not connected 
to any of branches?

Fred


-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/git-users/-/eam9e4YzlGYJ.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



Re: [git-users] Full Backup - Best Practice

2012-08-17 Thread Adam Prescott
On Fri, Aug 17, 2012 at 1:49 PM, Konstantin Khomoutov 
flatw...@users.sourceforge.net wrote:

 Quite probably.  The problem with `git clone` is that it's supposed to
 create a repository, but we keep the mirror repositories around
 (I mean, they are not tarred and gzipped, and just sit there waiting
 for the next backup round or for being used for disaster recovery).


If you create your repository with `clone --mirror`, a simple `fetch`
should be all you need to keep a backup, unless I'm missing something.

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



Re: [git-users] Warning: you are leaving 30 commits behind, not connected to any of your branches:

2012-08-17 Thread Konstantin Khomoutov
On Fri, 17 Aug 2012 06:35:24 -0700 (PDT)
Fred fredgarlo...@googlemail.com wrote:

 I've cloned a fresh repo with submodules and then cd library/module
  git checkout master
 
 it gives me a warning and I don't understand why and how to avoid it? 
 
 Warning: you are leaving 30 commits behind, not connected to
 any of your branches:
 
   2553655 Merge branch 'master' into prod
   6b07300 Fix build
  ... and 28 more.
 
 If you want to keep them by creating a new branch, this may be a good
 time to do so with:
 
  git branch new_branch_name 654646464
 
 Branch master set up to track remote branch master from origin.
 Switched to a new branch 'master'
 
 
 What is going wrong here? How did we managed to have commits not
 connected to any of branches?

Did you read [1]?  I'm not familiar with submodules, but the cited text
hints that the state of each sumbodule is checked out using that
specific commit's SHA-1 name, and so each submodule normally is in the
detached HEAD state.  Hence, if the master branch of that particular
sumbodule references a commit which is not equal to that specific
commit checked out in the submodule, when you check out that master
branch, you do really move that submodule's HEAD pointer and get that
warning.

I think reading through the whole chapter on submodules is a worthwile
thing.

1. http://git-scm.com/book/en/Git-Tools-Submodules#Issues-with-Submodules

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



Re: [git-users] Full Backup - Best Practice

2012-08-17 Thread Konstantin Khomoutov
On Fri, 17 Aug 2012 14:47:07 +0100
Adam Prescott a...@aprescott.com wrote:

  Quite probably.  The problem with `git clone` is that it's supposed
  to create a repository, but we keep the mirror repositories around
  (I mean, they are not tarred and gzipped, and just sit there waiting
  for the next backup round or for being used for disaster recovery).
 If you create your repository with `clone --mirror`, a simple `fetch`
 should be all you need to keep a backup, unless I'm missing something.
Good idea indeed.
But I still prefer my approach as the full information about how to
update a mirror repo is contained in the backup script itself.
Each mirror repo thus has almost no identity (besides the fact it
mirrors a specific repo), which, I think, is a good thing.

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



Re: [git-users] Warning: you are leaving 30 commits behind, not connected to any of your branches:

2012-08-17 Thread Fred
I think I have good understanding how submodules work. But still don't get 
why those commits are not connected to any branches. Why I am getting 
this warning? What I'm doing wrong? IMHO it should just do checkout master 
without warning.

On Friday, August 17, 2012 4:52:43 PM UTC+2, Konstantin Khomoutov wrote:

 On Fri, 17 Aug 2012 06:35:24 -0700 (PDT) 
 Fred fredga...@googlemail.com javascript: wrote: 

  I've cloned a fresh repo with submodules and then cd library/module 
   git checkout master 
  
  it gives me a warning and I don't understand why and how to avoid it? 
  
  Warning: you are leaving 30 commits behind, not connected to 
  any of your branches: 
  
2553655 Merge branch 'master' into prod 
6b07300 Fix build 
   ... and 28 more. 
  
  If you want to keep them by creating a new branch, this may be a good 
  time to do so with: 
  
   git branch new_branch_name 654646464 
  
  Branch master set up to track remote branch master from origin. 
  Switched to a new branch 'master' 
  
  
  What is going wrong here? How did we managed to have commits not 
  connected to any of branches? 

 Did you read [1]?  I'm not familiar with submodules, but the cited text 
 hints that the state of each sumbodule is checked out using that 
 specific commit's SHA-1 name, and so each submodule normally is in the 
 detached HEAD state.  Hence, if the master branch of that particular 
 sumbodule references a commit which is not equal to that specific 
 commit checked out in the submodule, when you check out that master 
 branch, you do really move that submodule's HEAD pointer and get that 
 warning. 

 I think reading through the whole chapter on submodules is a worthwile 
 thing. 

 1. http://git-scm.com/book/en/Git-Tools-Submodules#Issues-with-Submodules 


-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/git-users/-/IfdV2KOEU-AJ.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



[git-users] newbie: Merging from remote projects into my modified branch

2012-08-17 Thread tigerfoot
Hello,

I cloned a project someone else wrote (say github://author/foo) into my own 
repo and made several changes and have pushed them back to my own repo 
(github://me/foo).

I left the project alone for a while but now see the original author has 
made a lot of changes in his code, github://author/foo.  How can I merge 
his changes into my github://me/foo repo?

Thanks for any help.
-tf

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/git-users/-/oUf01PCa5CMJ.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



Re: [git-users] newbie: Merging from remote projects into my modified branch

2012-08-17 Thread Adam Prescott
GitHub covers this in their Fork A Repo help page:
https://help.github.com/articles/fork-a-repo

See the section, Pull in upstream changes.

Adam

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



Re: [git-users] newbie: Merging from remote projects into my modified branch

2012-08-17 Thread tigerfoot
That did the trick, thanks!  Bookmarked for future reference.

On Friday, August 17, 2012 2:59:18 PM UTC-5, Adam Prescott wrote:

 GitHub covers this in their Fork A Repo help page: 
 https://help.github.com/articles/fork-a-repo

 See the section, Pull in upstream changes.

 Adam


-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/git-users/-/hu-N1TmeCW4J.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



[git-users] Re: [newbie] convenience function: overwrite from remote?

2012-08-17 Thread Tom Roche

Tom Roche Monday, May 7, 2012 10:09:29 AM UTC-7
 How to [easily] overwrite managed files in an existing directory
 with the latest versions from a remote branch/repo, without merging
 or whack-n-clone?

as defined @ top of thread
https://groups.google.com/d/topic/git-users/vYnSjP5ueXs/discussion

Note again, I'm trying to keep it simple/easy for a group of
(relatively) new adopters who don't self-identify as software
engineers.

Peter J Weisberg Mon, 7 May 2012 15:35:02 -0700 (PDT)
 git fetch origin
 git reset --hard origin/master

 DON'T use `reset` if there's anything in the local branch history
 that you don't want to lose. `reset` affects the history of the
 current branch, not just the working files.

Belated thanks for that advice! which got us started. Since then
another workflow has evolved, about which I'd appreciate comments/
warnings, especially

* warnings of the form, under [plausible circumstances], your
  workflow produces [significant harms]

* pointers to existing tools handle this usecase better

0 User switches remote to the desired repo.

1 User runs bash script (follows my .sig to end of post) to see what
  if any changes have been made in remote.

2 If user wants to adopt changes, s/he does

$ git merge --no-commit [${TARGET}]

Seems to work, but is this likely to bite back? or is there
A Better Way(tm) to do this?

TIA, Tom Roche tom_ro...@pobox.com---script follows to end of post---

#!/usr/bin/env bash
# adapted from https://github.com/ddollar/git-utils/blob/master/git-incoming

# TODO: usage
# TODO: add --verbose, turn off echo-ing by default

TARGET=${1}
CURRENT_BRANCH=$(git branch /dev/null; if [ $? -eq 0 ]; then echo $(git 
branch | grep '^*' |sed s/\*\ //); fi)
echo -e CURRENT_BRANCH=${CURRENT_BRANCH}

if [[ -z ${CURRENT_BRANCH} ]]; then
  echo -e 'ERROR: cannot determine current branch'
  exit 1
else
  if [[ -z ${TARGET} ]]; then
TRACKING_REPO=$(git config branch.${CURRENT_BRANCH}.remote)
echo -e TRACKING_REPO=${TRACKING_REPO}
if [[ -z ${TRACKING_REPO} ]]; then
  echo -e 'ERROR: cannot determine tracking repository'
  exit 2
else
  REMOTE_REPO=${TRACKING_REPO}
  REMOTE_BRANCH=$(git config branch.${CURRENT_BRANCH}.merge | sed -e 
's#^[^/]*/[^/]*/##')
  TARGET=${REMOTE_REPO}/${REMOTE_BRANCH}
  echo -e REMOTE_REPO=${REMOTE_REPO}
  echo -e REMOTE_BRANCH=${REMOTE_BRANCH}
  echo -e no TARGET specified by command, using TARGET=${TARGET}
fi
  fi
fi

# payload
echo -e Incoming changes from TARGET=${TARGET}
# TODO: only diff if -n $(git log)
for CMD in \
  git fetch \
  git log ..${TARGET} \
  git diff ..${TARGET} \
; do
  echo
  echo -e $ ${CMD}
  eval ${CMD}
done
exit 0

# Note on double dots '..' above from 2nd answer @ 
http://stackoverflow.com/questions/4944376/how-to-check-real-git-diff-before-merging-from-remote-branch
#  You can use various combinations of specifiers to git to see your diffs as 
you desire:

#  $ git diff remote/origin   
#  This shows the incoming remote changes as deletions; any commits in your 
local repository are shown as additions.

#  $ git diff ...remote/origin
#  Shows incoming remote changes as additions; the triple-dot excludes changes 
committed to your local repository.

#  $ git diff ..remote/origin
#  Shows incoming remote changes as additions; the double-dot includes changes 
committed to your local repository as deletions (since they are not yet pushed).

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



Re: [git-users] Re: [newbie] convenience function: overwrite from remote?

2012-08-17 Thread Łukasz Siwiński
 CURRENT_BRANCH=$(git branch /dev/null; if [ $? -eq 0 ]; then echo
$(git branch | grep '^*' |sed s/\*\ //); fi)

Does Your 5th line is missing closing bracket or maybe I don't understand
something?

Pozdrawiam,

-- 
Łukasz Siwiński
17-08-2012 23:39, Tom Roche tom_ro...@pobox.com napisał(a):


 Tom Roche Monday, May 7, 2012 10:09:29 AM UTC-7
  How to [easily] overwrite managed files in an existing directory
  with the latest versions from a remote branch/repo, without merging
  or whack-n-clone?

 as defined @ top of thread
 https://groups.google.com/d/topic/git-users/vYnSjP5ueXs/discussion

 Note again, I'm trying to keep it simple/easy for a group of
 (relatively) new adopters who don't self-identify as software
 engineers.

 Peter J Weisberg Mon, 7 May 2012 15:35:02 -0700 (PDT)
  git fetch origin
  git reset --hard origin/master

  DON'T use `reset` if there's anything in the local branch history
  that you don't want to lose. `reset` affects the history of the
  current branch, not just the working files.

 Belated thanks for that advice! which got us started. Since then
 another workflow has evolved, about which I'd appreciate comments/
 warnings, especially

 * warnings of the form, under [plausible circumstances], your
   workflow produces [significant harms]

 * pointers to existing tools handle this usecase better

 0 User switches remote to the desired repo.

 1 User runs bash script (follows my .sig to end of post) to see what
   if any changes have been made in remote.

 2 If user wants to adopt changes, s/he does

 $ git merge --no-commit [${TARGET}]

 Seems to work, but is this likely to bite back? or is there
 A Better Way(tm) to do this?

 TIA, Tom Roche tom_ro...@pobox.com---script follows to end of post---

 #!/usr/bin/env bash
 # adapted from
 https://github.com/ddollar/git-utils/blob/master/git-incoming

 # TODO: usage
 # TODO: add --verbose, turn off echo-ing by default

 TARGET=${1}
 CURRENT_BRANCH=$(git branch /dev/null; if [ $? -eq 0 ]; then echo
 $(git branch | grep '^*' |sed s/\*\ //); fi)
 echo -e CURRENT_BRANCH=${CURRENT_BRANCH}

 if [[ -z ${CURRENT_BRANCH} ]]; then
   echo -e 'ERROR: cannot determine current branch'
   exit 1
 else
   if [[ -z ${TARGET} ]]; then
 TRACKING_REPO=$(git config branch.${CURRENT_BRANCH}.remote)
 echo -e TRACKING_REPO=${TRACKING_REPO}
 if [[ -z ${TRACKING_REPO} ]]; then
   echo -e 'ERROR: cannot determine tracking repository'
   exit 2
 else
   REMOTE_REPO=${TRACKING_REPO}
   REMOTE_BRANCH=$(git config branch.${CURRENT_BRANCH}.merge | sed -e
 's#^[^/]*/[^/]*/##')
   TARGET=${REMOTE_REPO}/${REMOTE_BRANCH}
   echo -e REMOTE_REPO=${REMOTE_REPO}
   echo -e REMOTE_BRANCH=${REMOTE_BRANCH}
   echo -e no TARGET specified by command, using TARGET=${TARGET}
 fi
   fi
 fi

 # payload
 echo -e Incoming changes from TARGET=${TARGET}
 # TODO: only diff if -n $(git log)
 for CMD in \
   git fetch \
   git log ..${TARGET} \
   git diff ..${TARGET} \
 ; do
   echo
   echo -e $ ${CMD}
   eval ${CMD}
 done
 exit 0

 # Note on double dots '..' above from 2nd answer @
 http://stackoverflow.com/questions/4944376/how-to-check-real-git-diff-before-merging-from-remote-branch
 #  You can use various combinations of specifiers to git to see your
 diffs as you desire:

 #  $ git diff remote/origin
 #  This shows the incoming remote changes as deletions; any commits in
 your local repository are shown as additions.

 #  $ git diff ...remote/origin
 #  Shows incoming remote changes as additions; the triple-dot excludes
 changes committed to your local repository.

 #  $ git diff ..remote/origin
 #  Shows incoming remote changes as additions; the double-dot includes
 changes committed to your local repository as deletions (since they are not
 yet pushed).

 --
 You received this message because you are subscribed to the Google Groups
 Git for human beings group.
 To post to this group, send email to git-users@googlegroups.com.
 To unsubscribe from this group, send email to
 git-users+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/git-users?hl=en.



-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.