CARVIEW |
Navigation Menu
-
-
Notifications
You must be signed in to change notification settings - Fork 98
Convenient way to move branch pointer around? #402
-
When adopting the divergent workflow, I often need to point branch pointer to head to exit detached head mode, so I may upload my work to git server. Currently, I'm doing this:
Is there a better way? |
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 2 comments · 3 replies
-
Hi @PhotonQuantum, can you clarify a little more about your workflow? What do you do after I think there's two parts of your problem which have to be addressed:
For syncing, git-branchless provides the If you want to do a merge, you can also just do it the other way, and write Or, you can run For pushing, you could just run I personally don't use a local main branch at all, and I just work using If you're using a service which requires you to have a branch name, then there's not much you can do about that. I usually do UPDATE: I recently learned that UPDATE: |
Beta Was this translation helpful? Give feedback.
All reactions
-
π 1
-
Oh I didn't know I can force update a branch. This is what I want first. My old workflow involves a local main branch, and potentially several temporary feature branches. Now I'm integrating this workflow with the divergent one. The idea of complete branchless is brand new to me, but certainly sounds an interesting one! As you said, the biggest problem is external services. Intellij IDEs warn me when I commit to detached head, and Github PR creation requires a branch. So I'm taking traditional branch approach when pushing and starting a review, and quick prototyping using this branchless approach. So far I'm quite satisfied this workflow. Anyway thanks for your great tool and helpful answer! |
Beta Was this translation helpful? Give feedback.
All reactions
-
π 2
-
In the use case where you want to fast-forward a local branch, |
Beta Was this translation helpful? Give feedback.
All reactions
-
π 1
-
If you are just trying to merge an anonymous branch into If the merge would be a fast forward merge (ie your anonymous branch is already based on the current |
Beta Was this translation helpful? Give feedback.
All reactions
-
π 1
-
Thanks for your reply! I thought git would reject a bare commit and require a named branch because this was what some random stackoverflow answers said, but it turns out to be false. |
Beta Was this translation helpful? Give feedback.
All reactions
-
π 1
Hi @PhotonQuantum, can you clarify a little more about your workflow? What do you do after
git merge temp
? Do yougit push
themain
branch? Or, for example, do you use the branch to open a code review for others to see?I think there's two parts of your problem which have to be addressed:
main
, without branches?For syncing, git-branchless provides the
git sync
command, which will rebase your stacks on top of themain
branch. Note that it does a rebase rather than a merge.If you want to do a merge, you can also just do it the other way, and write
git merge main
while you're on your commit.Or, yβ¦