Re: [git-users] How to add a file later to a commit?

2015-05-22 Thread Magnus Therning
On 22 May 2015 at 08:29, Konrád Lőrinczi klorin...@gmail.com wrote:
 How can I add a file later to a commit?
 I created a new branch and submitted a commit with 2 files.

 I observed, that one more file should have been submitted with this commit,
 so I would like to add a file to an earlier commit.

 Any solution for this?

If it's the latest commit you want to amend, then have a look att `git
commit --amend`.  If it's not the latest commit you can start with an
interactive rebase (`git rebase -i`), mark the commit you want to
change for 'edit', and then use `git commit --amend`.

/M

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

-- 
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] How to add a file later to a commit?

2015-05-22 Thread Konrád Lőrinczi
How can I add a file later to a commit?
I created a new branch and submitted a commit with 2 files.

I observed, that one more file should have been submitted with this commit, 
so I would like to add a file to an earlier commit.

Any solution for this?


Thanks,
Konrad

-- 
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] moving a directory from one repo to another with commit history

2015-05-22 Thread Kalpa Welivitigoda
Hi,

My question is basically moving a directory from one git repo to another 
with the commit history for that directory. Let me elaborate more.

Say we have two git repositories repoA and repoB with the following 
directory structure

repoA
 --dir1
-- dir1-1
-- dir1-3
 --dir2

repoB
 --dir1-2

I need to move the dir1-2 from repoB to repoA so that the directory 
structure of repoA will look like the following,

repoA
 --dir1
-- dir1-1
-- dir1-2
-- dir1-3
 --dir2

In doing so, I need to preserve the commit history for dir1-2 as well.

How can I achieve this? Are there any other alternative ways that I can 
achieve a similar outcome?

Thanks.

-- 
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] moving a directory from one repo to another with commit history

2015-05-22 Thread Konstantin Khomoutov
On Fri, 22 May 2015 04:04:43 -0700 (PDT)
Kalpa Welivitigoda callka...@gmail.com wrote:

 My question is basically moving a directory from one git repo to
 another with the commit history for that directory. Let me elaborate
 more.
 
 Say we have two git repositories repoA and repoB with the following 
 directory structure
 
 repoA
  --dir1
 -- dir1-1
 -- dir1-3
  --dir2
 
 repoB
  --dir1-2
 
 I need to move the dir1-2 from repoB to repoA so that the directory 
 structure of repoA will look like the following,
 
 repoA
  --dir1
 -- dir1-1
 -- dir1-2
 -- dir1-3
  --dir2
 
 In doing so, I need to preserve the commit history for dir1-2 as well.
 
 How can I achieve this? Are there any other alternative ways that I
 can achieve a similar outcome?

Use the `git subtree` command [*].

First, use `git subtree split` to produce a synthetic chain of commits
which only touched the directory you need the history of, then fetch
that history into the destination repository and merge it there.
For this, you can either use `git subtree add` or direct
subtree merging [1].

Note that the commits in the chain `git subtree split` produces are
synthetic (i.e. created by `git subtree split`), and their SHA-1 names
do not match to those in the original repository's history.

[*] This command should now be available as part of Git.
If your Git install does not expose it directly, look for it
in the contrib section of your Git install and run it there --
it's just a POSIX shell script.

1. 
https://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html

-- 
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] moving a directory from one repo to another with commit history

2015-05-22 Thread Magnus Therning
On 22 May 2015 at 13:04, Kalpa Welivitigoda callka...@gmail.com wrote:
 Hi,

 My question is basically moving a directory from one git repo to another
 with the commit history for that directory. Let me elaborate more.

[...]

 How can I achieve this? Are there any other alternative ways that I can
 achieve a similar outcome?

Take a look at `git filter-branch`.  It's not easy to use, so I'd
recommend only working on a copy of the original repo, and reading up
on the command carefully before starting.

/M

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

-- 
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] moving a directory from one repo to another with commit history

2015-05-22 Thread Konstantin Khomoutov
On Fri, 22 May 2015 14:19:08 +0300
Konstantin Khomoutov flatw...@users.sourceforge.net wrote:

[...]
  Say we have two git repositories repoA and repoB with the following 
  directory structure
  
  repoA
   --dir1
  -- dir1-1
  -- dir1-3
   --dir2
  
  repoB
   --dir1-2
  
  I need to move the dir1-2 from repoB to repoA so that the directory 
  structure of repoA will look like the following,
  
  repoA
   --dir1
  -- dir1-1
  -- dir1-2
  -- dir1-3
   --dir2
  
  In doing so, I need to preserve the commit history for dir1-2 as
  well.
[...]
 Use the `git subtree` command [*].
[...]

To elaborate, a pseudocode (assuming a POSIX shell) is something like
this:

  $ cd repoB
  $ git tag Bdir12 $(git subtree split dir1-2)

  $ cd ../repoA
  $ git fetch ../repoB Bdir12
  $ git merge -s ours --no-commit Bdir12
  $ git read-tree --prefix dir1/dir1-2 -u Bdir12
  $ git commit --edit

-- 
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: Query on git submodules

2015-05-22 Thread Sarah Frawley
Thanks for the pointers Thomas - appreciate it :)

On Thursday, May 21, 2015 at 3:29:54 PM UTC+1, Thomas Ferris Nicolaisen 
wrote:

 On Wednesday, May 20, 2015 at 10:11:43 AM UTC+2, Sarah Frawley wrote:

 Hi there

 I am a design automation engineer supporting 200+ designers who use git 
 for hardware design.  We also use the submodule feature where we can have 
 quite complex hierarchy’s with 10+ layers.  We have experience issues with 
 re-use of design projects was we move from one project derivative to 
 another due to the complexity of the hierarchy along with lack of 
 discipline (using absolute paths in .gitmodule files). To enforce more 
 discipline I am currently working on a pre-commit hook to check the 
 integrity of .gitmodule files.  I would be interested in seeing how other 
 users in the community find submodules for large scale projects and if 
 there are any best known methods for using them.


 I think submodules are still considered advanced for many of the users on 
 this list, and many downright avoid them.

 You may be able to gather some more feedback from sharing your plans and 
 ideas with the Git development mailing list [1], as at least it is 
 frequented by the submodule developers. 

 I would also recommend investing a good few hours in trawling Google for 
 real deep articles on experiences and recommendations on using 
 submodules, as I know they are out there, but unfortunately buried in a mix 
 of articles about submodules for newbies and submodules sucks.

 [1] https://gist.github.com/tfnico/4441562 


-- 
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] Correct workflow for syncing tools

2015-05-22 Thread Bartłomiej Żogała
I have tools that I collected through years and which fit into the same 
categories on free machines - home desktop, laptop and corporate machine, 
now I want to sync them through git. I need possibility to have them in all 
places and need ability to do this selectively:
- laptop has SSD disk, it would get clogged if I pull all tools, I need 
only basic set and rest on demand
- home domain tools doesn't need to be present on workplace machine and 
viceversa
- some tools like to keep their configuration in current dir(git ignore )

Tools are organised into categories:
  - category 1
-tool 1 
-tool 2
-big file that shouldn't get synced into laptop with SSD disk but available 
on demand
-tool 3 
-small files
-corporate only file that can't get onto home machine
  - category 2 
-tool 1
-private tool that can't get onto corporate machine
-tool 3

Could you propose me some workflow? I know how submodules work and it'll 
partially fit into what I want to do, but wondering how to not being forced 
to sort files by attributes(corporate, home, big files) on filesystem. I 
would rather stay with sorting by category1, category2. Is it possible to 
sync basing on tags, or similar solution?



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