Questions tagged [git-checkout]

Checkout a branch or file to the current working tree in a Git repo.

git checkout is used to update files in the current working tree to a specific version in the index or specified branch.

To restore a file to the version in the index:

git checkout -- <filename>

Popular questions

See also

References

$ git checkout --help
1090 questions
-2
votes
1 answer

Creating sub branch structures and pushing

I want a similar structure to the below graph. Say I clone a project from github which has a main branch. I then want to create a server branch at the time which the main branch had its 2nd commit. Would I create a branch off of my local branch main…
Yogi Bear
  • 3
  • 4
-2
votes
2 answers

Git pull from master branch being in other branch

I created a new branch from the master and changed few files. How can i pull fresh files from master being in newly created branch and ignore/overwrite changed files in current branch?
VIK6Galado
  • 650
  • 14
  • 32
-2
votes
2 answers

What does checkout mean?

One of my professors told me to write a shell script that checkout code. His exact words are these : Write a shell script that will checkout the 'XYZ' code, compile it and run the unit tests. This XYZ code has a git repo too. He will be running…
Akhil
  • 41
  • 6
-2
votes
1 answer

Return uncommitted changes after "git checkout"

I had some changes on master and then I created a branch where I added all my changes. Then, I went back to master to remove the changes that I did. I entered git checkout . which unstaged all of my changes on master and the branch. Any ideas?
Karam
  • 336
  • 5
  • 18
-2
votes
1 answer

what is checkout with URl

I am a new programmer and also a brand new working with git. As my first assignment as a contributor to developing a program, I have been asked to install git and did these two steps: change to the directory under which you want to have the source…
Sara M
  • 17
  • 1
  • 7
-2
votes
1 answer

Git remove files for commit but keep them on disk

I'm really new to GIT, and I only know how to add submodules, commit and push. I don't know what is a HEAD, neither a branch, an origin, a master. I want to upload files to the server but the problem is I don't want to upload all files. GIT says to…
Zbarcea Christian
  • 9,367
  • 22
  • 84
  • 137
-3
votes
3 answers

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 filename. Example: git log --all --name-only -m…
klor
  • 1,237
  • 4
  • 12
  • 37
-3
votes
1 answer

How to switch branch without commit changes

Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) modified: …
Suraj
  • 1
  • 1
-3
votes
2 answers

Fastest approach to add a remote repository?

I need to check-out one branch at a time (may be another at different time). To make it fastest I am doing below steps. git remote add -f origin (at first time only) and on subsequent fetches for a particular branch git…
Ahmad
  • 2,110
  • 5
  • 26
  • 36
-5
votes
2 answers

I have a ruby project that needs a submodule from github

I have a typical ruby project and I would like to include a submodule within that project. The submodule lives on github. How do I use the git submodule command to include the submodule in my projects vender/plugins directory? Thanks.
JZ.
  • 21,147
  • 32
  • 115
  • 192
1 2 3
72
73