Reputation: 4152
I have cloned this repo. The v1.7 tag does not work with my code. But the v1.6 does.
I want to use v1.6. I tried the following;
git checkout tags/v1.6
I made one minor change and then attempted to commit to the master.
git add -A
git commit -m "not my real message"
git push origin master
I got the message "Everything up-to-date". When I went to my private repo on GiHub, it doesn't show any changes today. Like, I haven't done anything.
I'm not very experienced with git so I don't know what to try next.
This private repo is used in another bigger project, and injected using composer;
"private-repo/worldpay-lib-php": "dev-master"
How can I use v1.6 somehow?
Upvotes: 1
Views: 19
Reputation: 4626
When you checkout a tag, you're in detached HEAD
mode (git should have given you an info message along those lines), meaning that you can view the working tree and test your code but any commits you make won't progress any branch.
To do so, you must first create a branch on that tag:
git branch new_branch v1.6
Then checkout that branch:
git checkout new_branch
Now you can stage/commit and push as usual:
git add ...
git commit -m "your real message"
git push origin new_branch
Judging from your question, you seem to have forked a repository. If you've forked the project and you want your fork's master (not an arbitrary branch called new_branch
) to actually start from v1.6 and diverge from the upstream project for good, then you can continue with:
git checkout master
git reset --hard new_branch # reset master to the state of new_branch
git push origin master -f # overwrite you're repo's master branch
Note that this last operation assumes you won't be wanting to keep tracking the upstream repository (i.e. the original one that you forked).
Upvotes: 1