Questions tagged [git-checkout]
Checkout a branch or file to the current working tree in a Git repo.
1,096
questions
0
votes
0
answers
62
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 ...
0
votes
1
answer
38
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
77
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
51
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
43
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
16
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
54
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 ...
0
votes
1
answer
88
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
46
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 ...
0
votes
1
answer
134
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
35
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
61
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
76
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
78
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
38
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
2
answers
147
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
102
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 ...
1
vote
1
answer
1k
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
48
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
28
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
891
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
91
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
189
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
761
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/...
0
votes
0
answers
20
views
How to `git checkout <commit-ID> <filename>` with VScode? [duplicate]
From the command line, if I want to go back to a previous version of a specific file, I can checkout this file with a commit-ID like this :
git checkout <commit-ID> <filename>
I wonder how ...
2
votes
0
answers
286
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 ...
0
votes
2
answers
277
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
27
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
1
answer
296
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
52
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
287
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 ...
0
votes
0
answers
35
views
How to revert commits in local git? [duplicate]
I entered git checkout ( git number ) and I was thrown to this commit but deleted all the commits made above. Is there a way to return the files
Suggest solutions to the problem
2
votes
2
answers
545
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
1
answer
55
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 ...
1
vote
2
answers
90
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
382
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
340
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
24
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
1k
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 ...
1
vote
3
answers
417
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. ...
0
votes
0
answers
25
views
Trying to checkout to a previous commit ID. I get the results: "warning: unable to rmdir" [duplicate]
My teammates on Github had been working on a repository. My job is simply to go back to previous commits and see all the submodules.
So far I downloaded the repository to my computer.
I'm applying git ...
1
vote
3
answers
483
views
Git lab showing "There are no commits yet" after my git reset?
I have three branches in my GitLab
Main
ppp7
ppp7-master
ppp7---> ppp7-master---> main
every day I'm pushing my new code into ppp7 branch.if code is running fine in ppp7 branch, i create new ...
1
vote
0
answers
31
views
Weird behavior of git switch/checkout if index has same content as target commit [duplicate]
Let's create a small local repository:
git init
echo foo > foo
git add foo
git commit -m foo
git branch bar
echo foo >> foo
git commit -a -m 'another foo'
If we do this now, we replace our ...
1
vote
2
answers
118
views
What is the Git CLI equivalent of "Keep Current" in Visual Studio Git Changes window?
In Visual Studio, I can easily take the current (or incoming) branch's changes while resolving merge conflicts. This is like merging with --ours (or --theirs) merge strategy for a single file. Could ...
1
vote
3
answers
216
views
git checkout commit with specific trailer
I have an orphan branch (let's call it output) which contains the documents generated by templates stored on my main branch. I would like to checkout the commit on output that correspond to a specific ...
1
vote
3
answers
63
views
Why does this person (see link to article) use checkout to create a feature branch from the development branch and not fetch?
I thought you had to use fetch to get the latest version of a branch from the remote repository. If you do this as the person who wrote the article, don't you create a new feature branch from the &...
2
votes
0
answers
30
views
Is there a `git checkout <commit> -- .` variant that forces the working directory back to an old commit exactly, including removing new files? [duplicate]
Consider the following series of commands:
git init .
echo "Hello world" > Foo.txt
git add Foo.txt
git commit -m 'First commit'
echo Goobye > Bar.txt
git add Bar.txt
git commit -m '...
0
votes
2
answers
1k
views
Returning list as integer gives TypeError: 'type' object is not iterable [duplicate]
sum = []
def s(d):
d = list[int]
sum = []
for i in d:
sum += i
return(sum)
s([1, 2, 3])
Python gives me the following message:
TypeError: 'type' object is not iterable.
...
1
vote
3
answers
95
views
Is there a difference between "git merge" and "git checkout -b"?
https://git-scm.com/book/en/v2/Git-Branching-Remote-Branches
I would like to confirm that at the end of the "Pushing" section on the above page,
(1) Execute git merge origin/serverfix after ...
1
vote
2
answers
4k
views
How to create a GitHub action to checkout a specific commit in a private repository?
I have been using this documentation called Checkout Actions to build a Continuous Integration workflow using GitHub Actions. In general, it works when dealing with public and private repositories.
...