mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-10 14:44:28 +02:00
feat: command to simulate Merge/Pull Request
- Adds `git merge(M|P)R <source_branch> <target_branch> [--delete-after-merge]` command to simulate a Merge/Pull Request being merged into the target branch - The optional flag `--delete-after-merge` will remove the merged branch on the origin tree - The local remote branch remains as it is Git default behavior, even after `git fetch` (it would require `git fetch --prune` support to automatically prune remote tracking branches) - You can push a branch with a deleted remote tracking branch on origin, the ref will just update. Resolves #1057
This commit is contained in:
parent
99bc0ca8c5
commit
acffcc1616
3 changed files with 128 additions and 4 deletions
|
@ -453,10 +453,17 @@ GitEngine.prototype.findCommonAncestorWithRemote = function(originTarget) {
|
|||
};
|
||||
|
||||
GitEngine.prototype.makeBranchOnOriginAndTrack = function(branchName, target) {
|
||||
var remoteBranch = this.makeBranch(
|
||||
ORIGIN_PREFIX + branchName,
|
||||
this.getCommitFromRef(target)
|
||||
);
|
||||
var remoteBranch = this.refs[ORIGIN_PREFIX + branchName];
|
||||
|
||||
// If the remote branch exists but the branch on origin was deleted, updates its target location
|
||||
if (remoteBranch) {
|
||||
this.setTargetLocation(remoteBranch, target);
|
||||
} else {
|
||||
remoteBranch = this.makeBranch(
|
||||
ORIGIN_PREFIX + branchName,
|
||||
this.getCommitFromRef(target)
|
||||
);
|
||||
}
|
||||
|
||||
if (this.refs[branchName]) { // not all remote branches have tracking ones
|
||||
this.setLocalToTrackRemote(this.refs[branchName], remoteBranch);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue