5

I want to fork one github project code, but not from master branch, but from older release.

Reason: I want to edit one place in the code in my fork version and put the url of this tag version into my requirements.txt so that

pip install -e git+https://git_url_to_my_form_in_this_tag_version

works.

I found the tag version in github, but once I fork it, it is being forked from master and not from exactly that tag.

how can I do it?

doniyor
  • 36,596
  • 57
  • 175
  • 260
  • Have you read http://stackoverflow.com/q/13685920/3001761 – jonrsharpe Jun 17 '15 at 13:24
  • @jonrsharpe but I want to fork it so that I can be sure that my change is forever there. I need to change the code first after fork, and then install via pip – doniyor Jun 17 '15 at 13:26
  • Wait, which part of this are you stuck on? Specifying your forked, modified version in the `requirements.txt` or forking from the right version in the first place? If the latter, how about http://stackoverflow.com/q/9227873/3001761? – jonrsharpe Jun 17 '15 at 13:28

1 Answers1

13

Forking the repository clones the entire repository, not just the master branch. You can then checkout the tag you want to work on, make the required changes, and create a new tag.

# checkout the tag
git checkout tag_to_fork_from

# alternatively, create a new branch starting with the tag
git checkout -b mybranch tag_to_fork_on
Alasdair
  • 298,606
  • 55
  • 578
  • 516
  • thanks, I just cloned the code and changed the code and put aside for later installability via pip – doniyor Jun 17 '15 at 13:36
  • the new branch is now: https://github.com/bevedoni/django-allauth/tree/nametests_adjusted_version this version can be installed via: ``pip install -e git+https://github.com/bevedoni/django-allauth/tree/nametests_adjusted_version`` right? – doniyor Jun 17 '15 at 14:14
  • Instead of asking whether it will work, why not try it instead ;) – Alasdair Jun 17 '15 at 14:26
  • Using the [link](http://stackoverflow.com/q/13685920/3001761) that @jonrsharpe gave you, I think you want `pip install git+git://github.com/bevedoni/django-allauth.git@nametests_adjusted_version` – Alasdair Jun 17 '15 at 14:27