[git-users] Re: git commit --amend -F option help

2017-12-08 Thread Igor Djordjevic
Hi praveenm,

On Friday, December 8, 2017 at 8:02:48 AM UTC+1, praveenm mulimani wrote:
>
> Dear All,
>
> We are using git commit -F option to commit in git.
>
> when we use git commit --amend option with -F it is creating new gerrit 
> permalink.
> ex: git commit --amend -F /opt/commitmessage.txt
>
> How to amend the commit msg without creating new permalink.
>
> Let me know if  other options are available.
>
> Thanks in Advance
>

Would this be a "Gerrit" related/specific question, instead of a "Git" 
one...? If so, might be "Gerrit" mailing list is a better place for it -- 
https://groups.google.com/forum/#!forum/repo-discuss?

On the "Git" side, executing `git commit --amend -F /opt/commitmessage.txt` 
should just amend the commit using provided text file as commit message 
(replacing the previous one), not sure where the permalink part comes from 
(if not "Gerrit)".

Otherwise, hopefully someone here has more experience with this setup to 
help further.

Regards, Buga

-- 
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: worktree with orphan

2017-12-08 Thread Igor Djordjevic
Hi Philip,

On Friday, December 8, 2017 at 7:43:45 PM UTC+1, Phillip Lord wrote:
> 
> I'm trying to create a new worktree, but for an orphan branch. But I 
> can't find a way of doing this convieniently. 
> 
> I can checkout a new orphan branch: 
> 
> git checkout --orphan my-new-branch 
> 
> That works, but now I can't make a worktree because, I presume there 
> are no commits yet. 
> 
> fatal: invalid reference: another-new-branch

Indeed, worktree should point to something inside repository, and 
currently you have nothing - even your "my-new-branch" doesn`t really 
exist yet (as being orphaned it has no history), unless you commit 
something to it, as you noticed.

Doing `git branch` confirms this, no "my-new-branch" listed.

> More over, it leaves any files on master in place. 

Hmm, not sure what you remark to here, but if it is about leaving 
index and working tree in the same state as where you left off (I 
guess "master", in your case), that is by design, and it can be 
easily cleaned-up with `git rm -rf .`, if desired (see `git-checkout  

--orphan` docs[1] 
 
for more info).

> ... But, okay, I think, I can move back to master.
> 
> git checkout master 
> git worktree add ../my-new-branch my-new-branch 
> 
> But this fails for the same reason. 
> 
> git worktree  add ../my-new-branch my-new-branch 
> fatal: invalid reference: my-new-branch 

As your orphaned branch never really started existing in the first 
place (no commits on it), once you moved back to "master", you lost 
any track of it, and Git still (rightfully) complains about it 
missing just the same.

> So, the only solution is 
> 
> git checkout --orphan my-new-branch 
> 
> git commit (something) 
> 
> git checkout master 
> git worktree add ../my-new-branch my-new-branch 
> 
> All of which seems pretty painful. 
> 
> Am I missing something? 

On top of everything said above, I may suggest a possibly more 
satisfying alternative:

git worktree add --detach ../my-new-branch

We can inspect the current worktree state:

$ git worktree list
/test-repo   273bf25 [master]
/my-new-branch   273bf25 (detached HEAD)

Now, you can go to that worktree and do this:

git checkout --orphan my-new-branch

Inspecting the situation again, we get this:

$ git worktree list
/test-repo   273bf25 [master]
/my-new-branch   000 [my-new-branch]


Do note that "my-new-branch" still doesn`t really exist until the 
first commit is made there (as explained at the beginning of this 
e-mail), but might be you find this flow a bit more convenient...?

Regards, Buga

[1] https://git-scm.com/docs/git-checkout#git-checkout---orphanltnewbranchgt

-- 
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] worktree with orphan

2017-12-08 Thread Phillip Lord

I'm trying to create a new worktree, but for an orphan branch. But I
can't find a way of doing this convieniently.

I can checkout a new orphan branch:

git checkout --orphan my-new-branch

That works, but now I can't make a worktree because, I presume there are
no commits yet.

fatal: invalid reference: another-new-branch

More over, it leaves any files on master in place. But, okay, I think, I
can move back to master.

git checkout master
git worktree add ../my-new-branch my-new-branch

But this fails for the same reason.

git worktree  add ../my-new-branch my-new-branch
fatal: invalid reference: my-new-branch

So, the only solution is

git checkout --orphan my-new-branch

git commit (something)

git checkout master
git worktree add ../my-new-branch my-new-branch

All of which seems pretty painful.

Am I missing something?

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