[git-users] remote and remote-tracking branches

2016-03-04 Thread dmgf
Are they different objects?
In the Git user manual 
 it is written 
that "your local repository keeps branches which track each of those remote 
branches, called remote-tracking branches, which you can view using the -r 
option to git-branch.

Overall If I am not wrong there should be local branches and 
remote-tracking branches in my local repository, and remote branches at 
BitBucket or GitHub for instance.

I usually create a topic/feature branch with: git checkout -b topic-branch
I work on it and push it from time to time to BitBucket with: git push -u 
origin topic-branch
Then when I finished I merge topic-branch to master and push it to BitBucket

If in the end the work on my new feature was completed I would probably 
want to remove my local and remote topic-branch.
What then am I supposed to do? Delete only my local and remote branch or 
also my remote-tracking branch?

In other words, I should use all the following three commands:

git branch -d topic-branch
git push origin --delete topic-branch
git branch -dr origin/topic-branch


or only two of them are necessary?

-- 
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] remote and remote-tracking branches

2016-03-04 Thread Konstantin Khomoutov
On Fri, 4 Mar 2016 03:13:52 -0800 (PST)
dmgf  wrote:

> Are they different objects?
> In the Git user manual 
>  it is
> written that "your local repository keeps branches which track each
> of those remote branches, called remote-tracking branches, which you
> can view using the -r option to git-branch.
> 
> Overall If I am not wrong there should be local branches and 
> remote-tracking branches in my local repository, and remote branches
> at BitBucket or GitHub for instance.

Yes, that is correct.
I'd only note that calling branches in the remote repos "remote" is
just a matter of convenience: to those remote repos, these branches are
pretty much local.

Your local repository indeed contain only normal (local) branches
(which are updated solely by you) and remote-tracking branches which
are updated by `git fetch`.

[...]
> If in the end the work on my new feature was completed I would
> probably want to remove my local and remote topic-branch.
> What then am I supposed to do? Delete only my local and remote branch
> or also my remote-tracking branch?
> 
> In other words, I should use all the following three commands:
> 
> git branch -d topic-branch
> git push origin --delete topic-branch
> git branch -dr origin/topic-branch
>
> or only two of them are necessary?

It depends.  If you really want to wipe out any mentions of that branch,
the third command is necessary too: the way remote-tracking branches
work is somewhat asymmetrical to normal branches in that if a branch is
deleted in a remote repo you're tracking, the next `git fetch` against
that remote repo won't delete the matching remote-tracking branch.
So there are two ways to deal with such branches: one is that you
presented and another one is `git remote prune ` which
would reach for the identified remote repo, grab the list of branches
it has and make sure all your remote-tracking branches for that remote
which no longer exist there are deleted.

-- 
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] remote and remote-tracking branches

2016-03-04 Thread dmgf


On Friday, March 4, 2016 at 12:29:58 PM UTC+1, Konstantin Khomoutov wrote:
>
>
> It depends.  If you really want to wipe out any mentions of that branch, 
> the third command is necessary too: the way remote-tracking branches 
> work is somewhat asymmetrical to normal branches in that if a branch is 
> deleted in a remote repo you're tracking, the next `git fetch` against 
> that remote repo won't delete the matching remote-tracking branch. 
> So there are two ways to deal with such branches: one is that you 
> presented and another one is `git remote prune ` which 
> would reach for the identified remote repo, grab the list of branches 
> it has and make sure all your remote-tracking branches for that remote 
> which no longer exist there are deleted. 
>

I understand that the two commands do the same job with a substantial 
difference:
git branch -dr origin/topic-branch can be used when there is only one 
remote-tracking branch to be deleted, while git remote prune  has 
to be used when there is more than one remote-tracking branch, unless I 
wanted to clean up the references one by one.
I take for granted that your command should be used as git remote prune 
origin and not git remote prune origin/topic-branch, and that should be 
called after git branch -d topic-branch and git push origin --delete 
topic-branch.

I also found git fetch --prune at stackoverflow 
probably
 
to be used as git fetch origin --prune.

-- 
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] warning in tree ad82bbbe50a28ff5e712c1a18986908168afbf10: contains '.git'

2016-03-04 Thread Matěj Cepl
Hi,

I have clone Mercurial repository from 
https://bitbucket.org/fbennett/citeproc-js using git 1.8.3.1 and 
git-remote-hg from https://github.com/felipec/git-remote-hg.  
When I did I run

   $ git fsck

on the result and got this:

 $ git fsck
 Checking object directories: 100% (256/256), done.
 warning in tree ad82bbbe50a28ff5e712c1a18986908168afbf10: contains '.git'
 Checking objects: 100% (46524/46524), done.
 $

Ignoring that most likely this is most likely a bug in 
git-remote-hg, what can I do with such repo?

1) Is there a tool which would find all commits to which tree 
ad82bbbe50a28ff5e712c1a18986908168afbf10 belongs?

2) I hoped that

 $ git filter-branch --tree-filter \
 'git rm --cached -q -f -r .git ||/bin/true' HEAD

might be the cure for my problems. However, it went through 
and (even after git gc --prune=now) I still get the same 
error in git fsck.

3) Another way of attack was to find by a weird combination git 
log and git cat-file -p in crazily long pipe (which I cannot 
reproduce right now) that the offending tree could be 
somewhere in the commit 
a65687ba0176848425c22ea21007deea0406e069

So I ammended the parent commit with the removal of 
locale/.git subdirectory and marked the branch as 
fixed_commit. Original bad commit which introduced 
locale/.git I marked as branch bad_commit and run

$ git rebase --onto fixed_commit bad_commit master

Then I removed the bad_commit and fixed_commit branches and 
run git gc --aggressive --prune=now

... git fsck still shows the same error (on the same object)

So, as a last resort I exported whole repository with git 
fast-export to a file and imported to a new fresh directory 
(with git init beforehand) via git fast-import && git 
checkout -f (not sure, which it has to be there, but it 
must). And ...

git fsck shows the same error.

(for those who would say, that I should just ignore the warning, 
it apparently breaks my attempts to push to a remote git 
repository).

Any ideas, what to do?

Best,

Matěj

-- 
https://matej.ceplovi.cz/blog/, Jabber: mc...@ceplovi.cz
GPG Finger: 89EF 4BC6 288A BF43 1BAB  25C3 E09F EF25 D964 84AC
  
Do not long for the night, when people vanish in their place.
Be careful, do not turn to evil; for you have preferred this to
affliction.
   -- Job 36:20f (NASB)

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


pgpVR3lJbZltO.pgp
Description: PGP signature


[git-users] Hook that fires on git reset

2016-03-04 Thread Mike Lewis
Is there any hook that fires when a 
git reset
command is issued? The natural assumption would be the 
post-rewrite
hook, since part of the history is being rewritten, but it does not, both 
according to the official documentation and some experiments that I've run. 
The hook doesn't necessarily have to be a reset-specific hook, I just need 
something that fires when a reset is performed.

-- 
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] Git says there are local changes, but there are no changes. (Windows)

2016-03-04 Thread Ben Page
The repos that exhibit this behavior are Visual Studio projects and the 
problem files are text files.

I don't think the problem is line endings. git diff returns nothing and the 
projects have * text=auto in the .gitattributes file and core.autocrlf set 
to true.

I believe the problem is caused by Visual Studio. This never happens on any 
project that doesn't use it. But I don't know what it's doing to the files.

What I'm most confused by is why doesn't git checkout or git reset --hard 
resolve 
the problem. Why do I have to delete the .git\index for git to properly 
recreate these file?

On Wednesday, February 24, 2016 at 10:03:24 AM UTC-6, Dale R. Worley wrote:
>
> Ben Page  writes: 
> >>git status 
> > On branch master 
> > Your branch is behind 'origin/master' by 2 commits, and can be 
> > fast-forwarded. 
> >   (use "git pull" to update your local branch) 
> > Changes not staged for commit: 
> >   (use "git add ..." to update what will be committed) 
> >   (use "git checkout -- ..." to discard changes in working 
> directory) 
> > modified: XXX 
> > modified: YYY 
> > no changes added to commit (use "git add" and/or "git commit -a") 
>
> Certainly one thing you can do is "git diff XX" and see what Git 
> thinks the changes are. 
>
> Unfortunately, I don't know if git-diff is completely rigid about 
> reporting different ends-of-lines.  You can 
> mv XX XX.old 
> git reset --hard 
> diff XX XX.old 
> if you know that the diff you are using reports all byte differences. 
>
> As the other responder said, the underlying cause is likely file name 
> casing or ends-of-lines, which are the sort of things that get 
> translated between files in the working directory and the repository. 
>
> Dale 
>

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