Questions tagged [git-branch]
git-branch is the Git command that manages branches.
3,223
questions
1
vote
2
answers
56
views
Git copy commit without checkout or rebase?
I am currently on commit 123456 and branch foo. I'd like to add a new commit to branch bar with the exact contents of 123456 (not rebased, just created from the same snapshot, so the diff will be ...
0
votes
0
answers
12
views
Deriving branch name in a Git CI/CD tag pipeline
I need to take certain actions during a Git CI/CD pipeline under the following conditions:
A new tag has been created
The branch name is 'develop'
Tags are associated with commits, not branches, so ...
0
votes
1
answer
21
views
Visual Studio switch/merge/get rid from multiple repository/branches to single repository/branch
Regarding Visual Studio 2022 I have had repositories/projects:
a) C:\_GIT\RepositoryA\Project1
b) C:\_GIT\RepositoryMain
I have moved Project1 folder from a) to b)
Changed some files or somehow at ...
0
votes
1
answer
39
views
How to revert git branch with all commits?
I was deleted my barnch form Github Branch Page.
What i did before deleted my branch?
Resetup my ubuntu os, git SSH keys, downloaded repo zip file.
Extract the zip file.Then added remote url.
Then ...
0
votes
1
answer
46
views
Delete git branches on server
how can I delete this two branches:
remotes/main/main
remotes/main/HEAD
CMD result of git branch -vaa
The remotes/origin/... branches are correct.
I tried:
git push origin -d main/main
-> error: ...
0
votes
0
answers
8
views
Git pull folders not present in Dev branch but keep other Dev folders unchange
I need help with some git pulling/merging
2 branches: master and dev
Present states:
State of folder0 and folder1 in master and dev = different
State of folder2 in master and dev = present in master, ...
0
votes
1
answer
43
views
Handling hotfixes when working only with git master branch
I keep reading how people are forgoing the develop git branch and doing all work on master - and how this makes everything simpler.
I tried it:
I have a master branch (with linear history) and many ...
0
votes
0
answers
29
views
git merge conflicts due to reverting: what strategies can be used to avoid such conflicts?
this images describes the issue we were facing
branch k had merged b2 into itself, which was a mistake, we actually did not want any b2 related changes going into k.
then k merged itself into b1, ...
1
vote
1
answer
78
views
Intellij: use underscore default in branch naming
I am using the latest version of IntelliJ. The behavior in automatic space replacing seems different, when I am creating a new branch.
For example, if I've named a branch "test branch" in ...
0
votes
0
answers
30
views
Git: Delete branch alternative (VSCode)
In VSCode, I automatically prune while fetching branches from github. However, branches I locally edited stay on my vscode and the only way I currently know how to remove them is to Git:Delete Branch ...
1
vote
3
answers
62
views
Git Make new branch and push without history
I have been trying to google for a solution but wasnt able to find exactly what I'm looking for, hence the new question.
I have a private git repo with only 1 branch (master) that has ~90 commits.
I ...
0
votes
1
answer
21
views
GitLab IDE, advice needed
I need some advice about using the GitLab IDE. I think I understand what it's done to me, but I don't know how to recover.
I've been making extensive edits to a merge request in the IDE, in the course ...
-1
votes
1
answer
27
views
Making new repository on GitHub
I've been self learning and while making repository in GitHub, I noticed that I have an extra line displayed in contrast to the tutorials I am watching despite doing exactly what the tutorial does.
...
0
votes
0
answers
60
views
How to know what roles or permissions are allowed to push code/PR to production using Azure DevOps REST API
I need to get from the Azure Devops list of a users who are allowed to push code/PR to master/main branch. This list should be foreach repo seperatly.
But, after searching Rest Api doct for Azure, ...
0
votes
2
answers
50
views
Git - Working with dependent branches in PR based workflow
I am working in a PR based workflow and here is the situation created
Two branches were created from master
1. branchA library changes, with its own ongoing PR
2. branchB app depending on library, ...
0
votes
0
answers
23
views
Linking Azure Dev Ops with GitHub - Replace ADO Repo with GitHub Repo
Is it possible in Azure Dev Ops (ADO) to do the below?
Link ADO Repo to GitHub Repo.
When we create branch in ADO, it is actually creating branch in GitHub Repo and not in ADO Repo.
When we create ...
1
vote
1
answer
33
views
Revert changes in Git "main" to prior commit, after branching out with all changes since in "new-branch"
I erred by working locally on a local repo's "main" branch, instead of branching out with a new branch and modifying code there. I brought more modifications to the code than I thought I ...
0
votes
0
answers
35
views
why one of my github branch GUI looks different from the other branches?
I noticed this (maybe)issue just an hour ago.
In the first image, GUI is normal github branch I used to know.
But branch in the second image, something is different from normal-looking branches.
There ...
0
votes
1
answer
46
views
git sparse checkout and get all branch
My Requirement was to checkout a specific directory from a repo and also checkout each branch which has that directory and copy each branch directory to a target path.
For Example football is a repo ...
0
votes
1
answer
43
views
Set the remote branch pushed to by default
I want to setup the push default remote branch for my local branch.
Eg, I want my local branch main to push to origin/master.
I've tried:
git branch --set-upstream-to origin/master
But this only ...
-2
votes
1
answer
45
views
Does git not highlight the branch name on which we are after we switch to a branch using its case insensitive name
Suppose I am on a branch named main in git and we can confirm it by git branch and git log commands.
Screen shot of git bash.
But as branch names are case-insensitive in git. So, when we switch to any ...
0
votes
1
answer
44
views
Git Branch Deletion (laravel-breeze)
if i create branch and make changes in it and then suddenly realized that I don't these changes that I made. At that time if I delete git branch, will it make my project like the old one.
I have not ...
0
votes
0
answers
40
views
How to combine two history commits without making the whole history linear?
For example I have a commit history like this
* commit XXX
|\ Merge: XXX XXX
| |
| | Merge branch 'dev'
| |
| * commit XXX
| |
| | e
| |
| * commit XXX
| |
| | d
| |
| * commit XXX
| |
|...
0
votes
0
answers
30
views
Multiple "init.default" entries in Git config
I just got into learning Git, and I saw that I need to config the git init default branch's name (barely even know what it is yet).
So I type this:
git config --global init.default branch XXXX
(with ...
0
votes
0
answers
7
views
After I created 2 branch (master and new) I made changes in master,Normally I shouldnt see on my new branch .But I can see on it.How can I solve this
Normally, the changes made in the master should not be visible in the branch,but I can see changes
in other branchs, while the changes made in the branch should not be visible in the main. How can I ...
0
votes
1
answer
18
views
In GitHub can I create a branch from a secondary branch and then merged it to main?
So I have the main branch.
I usually open a new branch to get some work done, let call this branch_1.
I have now finished my work on branch_1 and open a PR to main. But while I wait I want to do more ...
-1
votes
1
answer
59
views
Why does git clone not copy remote branch and give error message when git status? problem with upstream?
I just created my own github page which is finalexam96.github.io
On Visual Studio Code, I did git clone https://github.com/finalexam96/finalexam96.github.io.git
I created an index.html file committed ...
1
vote
1
answer
475
views
Where is the delete branch option in Gitea's website interface?
Right now, I'm exploring and getting familiar with the Gitea interface.
I must be blind since I've done this before with GitHub, GitLab, CodeStar, and many more.
I feel crazy for asking this but, ...
0
votes
1
answer
146
views
How do I switch branches in Git Gui?
I cant seem to figure out how to switch branches in Git Gui.
In Git Gui , I have cloned a repository from GitHub. There are 2 branches: main and development.
I used the Branch > Create option to ...
0
votes
1
answer
92
views
How to modify the branch protection rule in GitHub to merge the pull requests created from a feature branch with specific name pattern
I have a master branch in my GitHub repo. I would like to apply some branch protection rule to the master so that the pull requests will be merged to master only if the pull requests are created from ...
-1
votes
2
answers
52
views
git fetching and merging when origin and local and very different
I am working with a team project.
There is this branch "current_feature" made by other developer.
So I did git fetch origin current_feature and then git checkout current_feature.
With that I ...
0
votes
1
answer
398
views
What is meaning of blue dot in the left gutter in VS Code's integrated terminal?
I am new to Git and working with Git in VS Code. I created some branches and you can see them in the below image
Why does branch b3 have a blue dot? what does it mean? I use VS Code, can we see this ...
0
votes
0
answers
15
views
Fabric 2.7.1 how do I deploy a specific git branch
I've hit a bit of a wall with fabric. I'm trying to deploy a specific branch to my server. I can deploy the main branch the normal way using the Terminal command
fab dev www release
where dev is the ...
0
votes
1
answer
87
views
How does Github (not Git) solve merge conflicts when pushing to remote repository?
I have completed two Github tutorials but this topic was not covered in any of them.
My confusion is, when 5 developers are working on the same branch, they all start working at 10 in the morning, ...
0
votes
1
answer
32
views
Change git history and branch
I have 2 branches which is created at the same time from master branch. Both has been merged to master after changes. Branch history look like below:
My git structure
I want to change the structure so ...
0
votes
0
answers
30
views
Cannot force push even after unprotecting branches
I made an error pushing a wrong commit to the remote repo and want to go back to the previous commit on the remote repo, so I'm using git push -f to achieve this.
I selected my username below in "...
2
votes
1
answer
57
views
Set an existing branch to detached HEAD (after `git rebase --onto`)
When I have a detached HEAD that's several commits ahead of an existing branch, what's the right command(s) to advance that branch to the detached HEAD without changing anything in my working ...
0
votes
1
answer
64
views
What happens in git merge if one file does not exist in merged branch
I have a question about several merges from different branches.
Steps
Consider A and B are up to date with Master.
A adds some files and changes some other files.
B also adds some other files.
A ...
1
vote
1
answer
387
views
git-commit-id-plugin does not print the git branch name
I use git-commit-id-plugin in my pom.xml as follows:
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<...
0
votes
1
answer
197
views
How to see all archived branches in Git
Is there a way to see all the branches that are archived?
I used this answer to archive some of my branches.
and there's a way to restore the branch after I have archived it, but only if I know the ...
0
votes
1
answer
60
views
git reset HEAD~1 vs git branch -f mainline HEAD~1
Assuming, current branch is mainline. mainline and HEAD pointer are pointing to the latest commit.
git reset HEAD~1
git branch -f mainline HEAD~1
To the best of my understanding both the commands ...
0
votes
2
answers
76
views
Git push commit on different branch
I have a git repository with two branches: master and new_feature. The new_feature branch is created based on master to implement a new feature, so before implementing this new feature they are the ...
2
votes
1
answer
60
views
How to have one branch with full history and one branch with squashed history?
I have are requirement that the main branch has only one (potentially big) commit per issue ID. However, to confirm to the best practice of small commits, I also need to create and keep(!) multiple ...
0
votes
1
answer
46
views
Different git submodules within different branches
Is it possible to have different submodules within different branches? For example, branch 1 would only see submodule 1 and branch 2 would only see submodule 2.
One option is to use git submodule ...
1
vote
1
answer
57
views
Apply only the changes from a new branch onto an older branch
I have 2 branches : feature1 and feature2 which are based on the develop branch. feature1 is based on an older commit while feature2 is more recent.
I want to get only the commits from feature2 that ...
0
votes
2
answers
38
views
How to overwrite my sit branch based on a tag from Main branch
I'm using Azure Devops server 2020.
Part of my maintanence task activity, need to overwrite a content in sit branch based on a tag from a main branch.
Eg: my main branch is tagged as below
1.0.3 -->...
0
votes
1
answer
26
views
How to fetch not the current branch and merge it with the current, without branch checkout
I usually work in the project which branches have so many differences, branch checkout is similar to start a new project. With branch checkout, IDE just hangs because too many changes (more than 2 ...
1
vote
0
answers
244
views
Create new git branch: azure.devops.exceptions.AzureDevOpsClientRequestError: The requested resource does not support http method 'PATCH'
Background:
I'm using the azure-devops-python-api - library in order to programmatically push a commit to my Azure DevOps organization (git) repository.
The Azure DevOps REST API docs for "Update ...
-1
votes
1
answer
31
views
How to merge the changes from one branch to another branch in git
I have created two branches from master branch. I have made some changes in the second branch. I am trying to pull the changes from second branch2 to first branch. I do not know how to merge the ...
1
vote
2
answers
71
views
Git Deleting a branch called "-delete"
I made a mistake.
I ended up accidently creating a branch called "-delete", and now I can't delete it locally.
when I run the command: $ git branch -d -delete I get the following error
error:...