git-checkout

Git checkout does not change anything

我的未来我决定 提交于 2019-12-18 12:45:15
问题 I really like git. At least, I like the idea of git. Being able to checkout my master project as a separate branch where I can change whatever I want without risk of screwing everything else up is awesome. But it's not working. Basically, my workflow is like this: Checkout stable version to a new branch to experiment with new code Make a bunch of changes - I have no intent on keeping any of this, I'm just experimenting. Look at all the stuff I changed Add all the changes to be tracked Commit

Git change branch when file of same name is present

a 夏天 提交于 2019-12-18 11:17:13
问题 I have in my git repo, a file named xyz. Coincidently, I also have a branch named xyz. Presently I am on master, but I want to checkout to branch xyz. The command to be used is simple $ git checkout xyz But this would checkout the file xyz to the present HEAD. How would I change my branch to branch xyz ? 回答1: As illustrated by commit a047faf (git 1.8.4.3+), you can also try: git checkout xyz -- (Note: the error message will be clearer with Git 2.21, Q1 2019) That would make clear that the xyz

How to get a copy of an older version of a file in a git repository?

自古美人都是妖i 提交于 2019-12-18 10:33:13
问题 I have a version of a .tex file from a number of commits ago that I would like to get a copy of. I have the sha1 hash value for the commit that has the version of that file that I want. I do not want to replace the current version of the file. Rather, I want to just get a separate copy of it that reflects its state at the older version. A lot of similar questions suggest using git checkout <sha1> -- file.tex , but this just keeps giving "error: pathspec 'file.tex' did not match any file(s)

git checkout all the files

坚强是说给别人听的谎言 提交于 2019-12-18 09:57:01
问题 How can I get rid of all the changes in all the files of my repository? Say I am in a branch and I did some changes. git status returns a set of files in the "Changes not staged for commit" and I notice I would like to get rid of all of these changes in all the files. How can I do this with a single command? I know I can do the following to checkout just one file: git checkout -- <file> I noticed that git checkout -- alone returns the list of all uncommited files. However, I cannot find a way

Checkout the git commit corresponding to a certain revision from the old SVN repository?

流过昼夜 提交于 2019-12-18 05:07:07
问题 I migrated my repository from SVN to git. I used THIS site. Now I have a bug in revision X. How do I checkout from my git repository, knowing only the revision number from my old SVN repo? Thank you for your Help. 回答1: You can find the git commit that corresponds to the Subversion revision with the git svn find-rev subcommand. For example, if you're looking for the commit that corresponds to Subversion revision 3431 you can do: $ git svn find-rev r3431 42ed8bcf690fd0c655c5cee91b09258318fc56e8

Convert an SVN checkout to use git (git-svn)

假装没事ソ 提交于 2019-12-18 01:28:33
问题 I work with software that is kept in svn for version control. I would like to use git (git-svn) however the software requires lots of setup and configuration before it can be used. There are tools that take care of all of the setup, including checking out all the code via svn. All the documentation for git-svn (I've been able to find) requires a fresh checkout, using git-svn. Is there a way to convert an existing svn checkout so it can use git-svn? 回答1: You could do something like this: Do a

git stash blunder: git stash pop and ended up with merge conflicts

荒凉一梦 提交于 2019-12-17 21:25:41
问题 I did a git stash pop and ended up with merge conflicts. I removed the files from the file system and did a git checkout as shown below, but it thinks the files are still unmerged. I then tried replacing the files and doing a git checkout again and same result. I event tried forcing it with -f flag. Any help would be appreciated! chirag-patels-macbook-pro:haloror patelc75$ git status app/views/layouts/_choose_patient.html.erb: needs merge app/views/layouts/_links.html.erb: needs merge # On

Reuse GIT_WORK_TREE in post-receive hook to rm a few files

吃可爱长大的小学妹 提交于 2019-12-17 18:57:13
问题 I've used this 'tutorial' to set up a DSP environment: http://toroid.org/ams/git-website-howto (Yes, I don't have a T). My workflow is very easy: Develop locally ( D ) Commit a few things Commit more things Push to Staging (and Github) ( S ) Test new code on Staging Push to Production ( P ) My code contains CSS files that are minified by my code and then saved to 1 file: all.css . Locally, I've turned that option off, so I don't have to manually remove all.css all the time every time I change

git checkout --ours does not remove files from unmerged files list

*爱你&永不变心* 提交于 2019-12-17 17:31:51
问题 Hi I need to merge two branches like this. This is just an example what is happening, I work with hundreds of files which need resolution. git merge branch1 ...conflicts... git status .... # Unmerged paths: # (use "git add/rm <file>..." as appropriate to mark resolution) # # both added: file1 # both added: file2 # both added: file3 # both added: file4 git checkout --ours file1 git chechout --theirs file2 git checkout --ours file3 git chechout --theirs file4 git commit -a -m "this should work"

Show which git tag you are on?

谁都会走 提交于 2019-12-17 17:19:00
问题 I'm having trouble finding out which tag is currently checked out. When I do: git checkout tag1 git branch I can't seem to find out which tag I'm on. It only logs: * (no branch) master Is it possible to find out which tags are checked out? In the above example, this would be tag1 . 回答1: Edit : Jakub Narębski has more git-fu. The following much simpler command works perfectly: git describe --tags (Or without the --tags if you have checked out an annotated tag. My tag is lightweight, so I need