Questions tagged [git-checkout]
Checkout a branch or file to the current working tree in a Git repo.
git-checkout
1,105
questions
0
votes
0
answers
23
views
Creating Git Tag to a repository
I am checking out 3 repos and out of which 1 repo is from Github and other 2 are from bitbucket.
While creation of Tags, I want to create it only for the one which was checked out from Github, and not ...
1
vote
1
answer
50
views
Confused about Git merge with multiple branches. How can I merge the changes made in a branch created from an existing Pull Request branch? [duplicate]
I had a project where I had to make some changes.
I created a first Pull Request:
git checkout -b v1
This PR is waiting to be reviewed and approved by my team lead.
Meanwhile, I had to open a second ...
-1
votes
0
answers
36
views
Issues connecting a local workspace to a GitHub repo and creating branches
I'm trying to connect a local workspace to an identical repository on GitHub. In this instance, I cannot use git clone so I'm trying to find a work-around. I seem to be able to set the remote url fine,...
-1
votes
2
answers
45
views
how to push an old reseted or reverted heads
I can go back and forward in my history using git checkout heads git revert heads git reset heads
And when I do git push origin main I get Everything up-to-date and no change on remote server.
how to ...
4
votes
1
answer
29
views
Git checkout with exclusions fails when branch isn't local
I'm trying to checkout a branch, but want to exclude the REAMDE.md and CHANGELOG.md files.
Working:
git clone [url] --no-checkout .
git checkout BranchnameA
git checkout BranchnameB # (any other ...
0
votes
0
answers
44
views
How do I revert git checkout from a feature branch? [duplicate]
I'm new to git.
I generally create a new feature branch from master & then work on the task.
Recently, I executed git checkout instead of git switch when moving from master to my existing feature ...
0
votes
1
answer
98
views
Checkout step in Azure Pipelines is giving Smudge downloading error when LFS is set to true
I have in my Azure Pipeline, checkout step with lfs:true in my release branch.
steps:
- checkout: self
clean: true
lfs: true
When the build runs, it gives the following error.
Error downloading ...
0
votes
3
answers
51
views
My VS Project .sln and .csproj missing after pulling from another branch
My project had a master branch and two separate branch for two users - branch1 and branch2. After merging the changes from branch2 to branch1, branch2 is now missing its .sln file and .csproj file. ...
1
vote
4
answers
75
views
Why checking out to a remote branch creates one locally
Let's say there's a remote branch named origin/nameofbranch. When I checkout to this branch using Git in Intellij, it automatically creates a local branch with the same name, why is that happening?
0
votes
1
answer
58
views
Can't checkout a branch because a submodule's commit is no longer on its remote
This is similar to Submodule commited branch no longer available but differnt such that its solution isn't applicable.
I just cloned a repo, and it has submodules, I have done a submodule update/init ...
0
votes
0
answers
39
views
Git checkout updates local branch and remote repository at the same time
I have a local repository with 3 branches - main, major-test, recovery - and a remote repository with equivalent branches - main, major-test, recovery. My current working branch is major-test.
During ...
1
vote
0
answers
672
views
Git LFS Repo Fails To Checkout On Jenkins With Status Code 130
I have several CIs set up on Jenkins to simply checkout master from a git LFS repo when there are new commits.
Every time the job builds however, it fails with the following error message:
Checking ...
1
vote
1
answer
55
views
Non-interactive git restore for specific lines in a file
I have a modified and not staged file myfile.txt.
I want to git restore (or git checkout) myfile.txt, but it must undo the modifications done only within the line range 15-17. How to do that?
I've ...
0
votes
1
answer
97
views
How to keep changes when switching branches without using `git stash`
I made some changes on branch x but I have not staged or committed any new changes, I get:
% git checkout other/existing/branch
error: Your local changes to the following files would be overwritten by ...
0
votes
0
answers
55
views
Why does Git fetch remember and use deleted local tracking branches
Can you tell me why git seems to remember and use its “fetch memory” for a deleted local repository? I delete a local branch that was tracking a remote, and when that remote is completely rebuilt with ...
0
votes
0
answers
226
views
GitHub Actions Checkout with LFS (Private Repo)
I am storing large files in JFrog Artifactory and rest of the code in GitHub. I am trying to use GitHub Actions Checkout to get the Git Repo code as well as files from the Artifactory.
Since my ...
0
votes
0
answers
17
views
Getting error while copying folder from one branch to another in gitlab repo
I want to copy folder Test from gitlab branch feature/Automation-Framework
to feature/Automation-package. I am using following command
git checkout feature/Automation-Framework-Bhoomi -- ...
0
votes
0
answers
315
views
VScode + git: does not checkout submodules
I try to use VScode as git-ui. The problem starts when using submodules.
If I switch to a branch all submodule-folders are empty and submodules are not recognized.
It seams that VScode doesn't perform ...
2
votes
1
answer
60
views
How to checkout a file from the current tracking branch?
We would like to checkout the current file from a the currently tracked remote branch. Currently we have:
git fetch && git checkout origin/main RoboFile.php
But we need to change this code ...
0
votes
1
answer
590
views
How to get checked out remote repository directory in github actions
I have github actions in repo knowyrtech/repo1 where I check-out knowyrtech/repo2 like below:
- name: Checkout code from a specific repository and branch
uses: actions/checkout@v3
with:
...
0
votes
1
answer
166
views
Is there a simple way to update somebody else's file on gist.github.com?
For some time now I've had my own (public) GitHub repository, really more of a gist repo but nobody explained that to me when I signed up some yarn ago. That's where I have uploaded code that may ...
1
vote
2
answers
1k
views
GitHub `actions/checkout`: Fetch history up to before the push event
In a GitHub Actions workflow triggered by a push event, I want to use the actions/checkout action to fetch the git history of all commits in the push event, plus the last commit before the push event (...
0
votes
0
answers
91
views
Azure Cli / Git Checkout previous HEAD is incorrect
I am getting strange results with Azure CLI Git checkout
I've tried adding the folloing to my pipeline.
checkout: self (to try force an exclusive checkout in case this was a problem)
clean: true
...
0
votes
1
answer
195
views
In Git, How do I checkout to a New Branch from an already Existing Branch?
I am a Ruby on Rails programming novice and new to VCS as well. I will explain my question with an example:
Scenario: I have created an rails application base using rails new AppName. An empty git ...
2
votes
1
answer
97
views
How can disbale poll scm for specific checkout in Jenkinsfile?
I have two repositories that one of them is cloned in another Jenkinsfile.
For example imagine we have two repositories one of them is called child
child Jenkinsfile:
pipeline {
agent any
...
-1
votes
1
answer
151
views
Jenkins GIT plugin: passing environment variables
I'm using git checkout as
checkout scmGit(
branches: [[name: 'stable-3.x']],
userRemoteConfigs: [[url: 'https://github.com/jenkinsci/git-plugin.git']])
I need to set an environment variable ...
0
votes
1
answer
73
views
Change files in working directory while not changing branch
In order to create a clean commit history and get rid of some files I don't want for a PR, I would like to set my working directory to be at the state of my branch, say B, but make git remain on ...
-1
votes
1
answer
282
views
What is the difference between "git reset --hard HEAD~1" and "git checkout ."?
I'm currently learning git, and I have issue what exactly do these commands do?
git reset --hard HEAD~1
git checkout .
What's the difference between the two? They both permanently delete the last ...
0
votes
1
answer
367
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 ...
2
votes
1
answer
3k
views
How do i checkout a single folder / file from a remote repo using github actions
I'm using github actions runner on windows.
I tried the below to checkout only the scripts folder from remote repo called betech from branch mm365 inside the current-folder\betech; but it checks out ...
0
votes
1
answer
68
views
Checkout local commit with libgit2
I'm trying to implement a simple checkout operation between 2 commit. The code executes without errors.
int checkout2() {
git_repository_free(repo);
git_repository_open(&this->repo, this->...
0
votes
1
answer
32
views
How to recover deleted files from git after switching branch without stash
I've made some local changes and didn't pushed to repository, accident tally switched to another branch without stashing my changes, i did
git checkout .
Now i realized that after switching to my ...
0
votes
0
answers
2k
views
Github actions/checkout@v3 - checkout another repo from the same Organization does not work
I have two repos A and B in the same organization on our self-hosted Github enterprise instance. Repo B is a dependency for the code in repo A, so I want to create a workflow in repo A, where both ...
1
vote
1
answer
211
views
Why .gitignore files are appearing in master while they are ignored in development branch?
I have a development branch, where in one of the sub-directories I created a .gitignore file, added the file(s) to be ignored, committed and pushed the change to development branch. But now when I ...
0
votes
0
answers
397
views
how to do checkout in github actions on remote server which is running somewhere using ssh?
Let's say there are two machines A and B, I'm inside A machine which works as a self-hosted runner in the GitHub actions. If I use checkout action, it will checkout to Machine A, what if I want ...
0
votes
1
answer
3k
views
fetch-depth: 0 on github actions checkout is not fetching all tags and refs
I have a repo which has a TAG 1.0.0 on main and i am running a github workflow on branch "dev"
steps:
- name: "Checkout Application repo"
uses: actions/...
3
votes
0
answers
419
views
Git: Could not reset submodule index when checking out
I'm trying to checkout a specific commit ID along with all its submodules.
git checkout --recurse-submodules 7fdb9221d958acda289904951fe6d37873e8cfbf
But I'm getting the following error:
fatal: not a ...
1
vote
2
answers
987
views
Git: How to checkout previous commit without committing changes?
I want to checkout a previous commit, but I've made changes, so it's prompting me to commit or stash the changes first. I don't have the changes at the point where I want to commit them yet. Is this ...
0
votes
1
answer
30
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 ...
3
votes
0
answers
667
views
git sparse checkout unable to switch branches
I have a two branches main and feature branch. In both the branches there are two folders f1 and f2. There is a file inside f1 folder called file1.txt.
main branch structure
-root
- f1
- file1.txt
...
-1
votes
2
answers
63
views
removing untracked change from git [duplicate]
I would appreciate if you help me in this problem I have with git. I am new with working with that. I need to remove untracked change from git. I have already tried "git checkout ." and &...
1
vote
1
answer
364
views
Jenkins Pipeline - Git checkout collision
We have a multi-stage pipeline in our CI, and some of the stages have their own nested stages that are parallelized and may run on the same or different agents (we request a certain agent label).
As ...
2
votes
2
answers
1k
views
Github Actions: Run .sh without checking out whole project?
Due to bandwidth limits, I'm trying to checkout a subfolder of my project to Github Actions and found this Action: https://github.com/marketplace/actions/checkout-files
New (broken) Script:
name: ...
1
vote
0
answers
72
views
Why is my clean filter running instead of my smudge filter when I checkout a branch?
Background:
I'm working on a repository that houses files needed for another program to run. Due to the nature of the other program, files that need to call other files have to do so with full file ...
2
votes
2
answers
1k
views
Why do I get "fatal: No url found for submodule path 'TestLibrary1' in .gitmodules" for a submodule that no longer exists?
Problem
When I try to checkout my repository using GitHub Actions I get the following error:
fatal: No url found for submodule path 'TestLibrary1' in .gitmodules
What I Tried
I tried removing the ...
-3
votes
3
answers
441
views
Remove all files from Git repo history with path having escape \ in filename with git filter-repo
I have special filenames with escape \ characters stored in Git repository on Debian 10 Linux.
Problem: it is not possible to git checkout files on Windows, which have incompatible characters in the ...
3
votes
3
answers
429
views
How to remove all files from GIT repo history with path having colon : in filename?
I have ISCSI node filenames with colons stored in GIT repository on Debian 10 Linux.
Example:
'iscsi/nodes/iqn.2000-01.com.synology:NAS01-DS916.nas/ff11::111:11ff:ff1f:1ff1,3260,1/default'
'iscsi/...
2
votes
1
answer
25
views
syncro file force with distant repo without merge [closed]
Problem is, i have a file on server branch release who has some conflict (<<<<<<<<<<<<<< ...... ) present on file on my server (repo local) but not on git ( ...
2
votes
2
answers
2k
views
Azure Devops pipeline - is it possible to checkout to pull requests?
I will like on every PR to test the code before it enter main branch.
I know I can do a build validation on the main branch which will cause a pipeline to run on every PR.
But this requires a separate ...
3
votes
3
answers
1k
views
git merge reverted but the changes needed
I have a feature branch, let's call it A, and a main line, let's call it B, where we deliver. The problem is the following:
Branch A was many commits ahead of branch B, nothing extraordinary so far. ...