2

I am newbie to Git and starting to learn it. I have been using SVN for quite a long time. I want to simulate following.

I have a main repo in folder 'main'. I can pull, commit and push in this folder. I have one folder in 'main' named 'srepo'. I am able to clone a subrepo in this folder 'srepo'

I added a few files to subrepo 'srepo' locally and want to push to upstream subrepo. when I execute command 'git subrepo add FileName.txt' then it gives me error git-subrepo: 'add' is not a command. See 'git subrepo help'.

When I execute command 'git subrepo commit' it gives me following message:-

git-subrepo: Command 'commit' requires arg 'subdir'.
  Usage: git subrepo commit <subdir> [<subrepo-ref>]
  Add subrepo branch to current history as a single commit.
  This command is generally used after a hand-merge. You have done a `subrepo
  branch` and merged (rebased) it with the upstream. This command takes the
  HEAD of that branch, puts its content into the subrepo subdir and adds a new
  commit for it to the top of your mainline history.

  This command requires that the upstream HEAD be in the `subrepo/<subdir>`
  branch history. That way the same branch can push upstream. Use the
  `--force` option to commit anyway.

  The `commit` command accepts the `--force` option.

After adding subdir name with commit command it says "git-subrepo: Can't commit: 'subrepo/origin' doesn't contain upstream HEAD."

Please let me know how fix this.

Same question has been posted at https://github.community/t5/How-to-use-Git-and-GitHub/Git-and-Git-Subrepo/m-p/5974#M1955

Mike
  • 2,132
  • 3
  • 20
  • 33
Tanzeel
  • 21
  • 2

0 Answers0