1

I have downloaded the dev site locally on Acquia dev desktop. Performed update of Drupal core. Opened in git bash when I run "Git branch" it showed detached head from"XYZ". I know a solution for this is creating a new file and merging to master. But what if i don't want to merger to master how do I push to tag in dev and not master.

sp31
  • 11
  • 2

2 Answers2

1

Following Aquia documentation, you could simply create your dev branch and push it:

git checkout -b [branchname]
# with Git 2.23+
git switch -c [branchname]
git push origin [branchname]

Check also if dev already existed with git branch -avv. The git switch command would automatically track origin/dev, as I mentioned here.

VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • Does this creates a new branch? Because I want to push changes to the same tag which I pulled data from the cloud. – sp31 Nov 19 '19 at 12:46
  • @sp31 A tag is immutable: you do not push to a tag. You add commits to a branch. If the remote branch origin/dev exists (git branch -avv), then you create a local branch, which will automatically track origin/dev, and push there. – VonC Nov 19 '19 at 13:01
  • Thank you for more clarity. So do I run- git push origin/dev – sp31 Nov 20 '19 at 06:28
  • @sp31 You do not push a remote branch, only a local one: git push -u origin dev: that will update origin/dev. – VonC Nov 20 '19 at 06:36
0

If what you want to create is tags and have them on a remote, you can do so very easily:

git tag tag1
git tag tag2
git tag tag3
git push some-remote tag1 tag2 tag3

You will still be in detached HEAD state.

eftshift0
  • 16,836
  • 2
  • 23
  • 36