When you issue "git checkout featureBranch" then native git tries to find a ref called featureBranch but can't find it. The thing is that in native git "git checkout featureBranch" also does a branch creation under the hood. Native git seems to be able to do the checkout without branch creation while JGit is not. Why can you say "git checkout featureBranch" and JGit forces you to do something similar to "git checkout -b featureBranch. I would like to comment first on the checkout issue. When I look at my repo, It looks like there was a merge conflict that couldn't resolve-which doesn't make sense? I either just checked out the exact remote featureBranch-which wouldn't have a merge conflict-or I created a new local featureBranch then am trying to rebase remote changes onto it-which again, wouldn't create a conflict if using `git pull -rebase`Īny and all help is appreciated! I am drowning here. The pull fails, and the error from ret.getRebaseResult().getStatus() is simply "STOPPED", which is uninformative. Here is where I get into trouble:Īfter either a `git checkout featureBranch` or `git checkout -b featureBranch`, I am about to do `git pull -rebase`.Īfter checking out / creating / whatever JGit is doing, if I try to do a rebase in JGit here using: However, it seems that JGit wants me to `().setCreateBranch(true).setName("featureBranch").call()` - which is misleading to me but I suppose is fine. `git checkout featureBranch`, not `git checkout -b featureBranch`, the latter of which is the real "create new branch". Now, in this scenario, my normal git workflow would simply be: I have an upstream branch: refs/remotes/origin/featureBranch. ![]() I am on refs/heads/master, I do a Git.fetch().call() and Git.pull().call() just to make sure everything is updated and current. I open my git repo with Git.open(), everything looks good. This should do something close to what you’re looking for: git config -global alias.My git intuition is failing me when using JGit for checkouts. Have sublime automatically figure out the corresponding local branch for each $remote and call it $local, and then have the entry perform the git branch -f $local $remote command, for each entry.Įasiest way to make this happen is with git aliases & you’ll be able to use them on the command line as well. Hell I’m not even sure plugins could do that - it all depends on how the API will be designed. ![]() I guess the current menu modification functionality is not flexible enough for something like that as of now. I want to be able to right click the commit currently pointed at by the remote branch (or several remote branches), have sublime create separate menu entries for each remote branch (with $remote being the remote branch in each entry), have sublime automatically figure out the corresponding local branch for each $remote and call it $local, and then have the entry perform the git branch -f $local $remote command, for each entry. I’m looking for a kind of Commit.sublime-menu & Remote Branch.sublime-menu hybrid. I don’t really like the Location Bar and it’s closed 99% of the time for me. Your suggestion is great and it helps a bit but it’s not exactly what I wanted - I want to be able to do that from the commit tree directly. I didn’t know about the menu modifications feature of Sublime Merge, this makes it so much more powerful. ![]() Is there anything similar to this in Sublime Merge? (it resets the local branch and immediately checks it out meaning you go straight to the up-to-date commit) Reset local branch with the name: 'feature' The Git Extensions client has the following checkbox when you try to checkout a remote branch, which is exactly what I’m looking for: This means that in order to work on the latest version of feature, I have to look around the graph view, find the local feature branch which is several commits behind, check it out (which inconveniently changes my work-tree to some old version, potentially interfering with IDE’s), then merge/reset it to sync it with the up-to-date origin/feature branch.Īnother option I have is to delete the local feature branch and then use the option pictured above, but that’s a bit awkward. ![]() However, if a corresponding feature branch tracking origin/feature branch already exists (out of sync with the remote branch, some commits behind), this option doesn’t appear anymore. This option is very convenient - it creates a branch named feature tracking origin/feature and it performs a checkout of that branch automatically. When I right click a remote branch in the graph view, there’s this option: # Checkout the now up-to-date feature branch Basically I’m looking for the Sublime Merge equivalent of the two following CLI commands: # Reset "feature" to "origin/feature" without checkout
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |