git-checkout

What's the git equivalent of “svn update -r”?

守給你的承諾、 提交于 2019-12-02 19:56:08
I'm a recent git convert. It's great to be able to use git-svn to keep my branches locally without disturbing the svn server. There was a bug that existed in the latest version of the code. I wanted to establish a time when it worked so that I could use git bisect. I couldn't find the right command to move back in time. Thanks. git checkout HEAD~1 This will move your current HEAD to one revision earlier. git checkout <sha> This will move your current HEAD to the given revision. Use git log or gitk to find the revision you’re looking for. And getting back to latest (equivalent to: svn up), you

How to switch android version in local repo?

假如想象 提交于 2019-12-02 19:19:15
I have downloaded whole working tree with the following command: repo init -u https://android.googlesource.com/platform/manifest repo sync -j8 After syncing successfully, I want to switch working tree to android 2.3.7. You see I didn't specify branch with "-b" parameter when "repo init". So I guess all tag info should be downloaded and I can easily switch to android 2.3.7 with the following command: repo forall -c git checkout android-2.3.7_r1 But it produces many errors like: error: pathspec 'android-2.3.7_r1' did not match any file(s) known to git. So how can I switch to android 2.3.7

How to do 'git checkout --theirs' for multiple files (or all unmerged files)

一笑奈何 提交于 2019-12-02 18:03:43
Say I have this after attempting a merge and upon entering git status : # Unmerged paths: # (use "git add/rm <file>..." as appropriate to mark resolution) # # added by them: myfile1.xhtml # added by them: myfile2.xhtml # added by them: myfile3.xhtml ... and I know I want to do this for each of those files: git checkout --theirs myfile1.xhtml git add myfile1.xhtml ... but there are many of them. How might I do them as a batch? The solution for my case ended up being to simply use a wildcard in the directory path, since the files were grouped: git checkout --theirs directory_name/* git add

To git checkout without overwriting data

旧城冷巷雨未停 提交于 2019-12-02 17:58:26
How can you git-checkout without overwriting the data? I run git checkout master I get error: Entry 'forms/answer.php' would be overwritten by merge. Cannot merge. This is surprising, since I did not know that Git merges when I git-checkout . I have always run after the command separately git merge new-feature . This seems to be apparently unnecessary if Git merges at checkout. Git is warning you that forms/answers.php has changes in your working copy or index that have not been committed. You can use git-stash to save your changes then git-stash apply to restore them. The common use case of

Visual Studio 2015 Git error message “Cannot pull/switch because there are uncommitted changes”

被刻印的时光 ゝ 提交于 2019-12-02 17:50:41
I am having difficulty in doing a pull from origin . I keep getting: "Cannot pull because there are uncommitted changes. Commit or undo your changes before pulling again. See the Output window for details." This also applies to switching branches. I get a similar sort of message, but this does not always happen. I am using Visual Studio 2015 Update 1 and Visual Studio Team Services Git. On my machine I have a local master branch, and development branches. Every time I switch to master and then I do a pull I get the error message. I have resorted to doing a stash and drop stash (command line)

git checkout tag, git pull fails in branch

坚强是说给别人听的谎言 提交于 2019-12-02 15:47:49
I have cloned a git repository and then checked out a tag: # git checkout 2.4.33 -b my_branch This is OK, but when I try to run git pull in my branch, git spits out this error: There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details git pull <remote> <branch> If you wish to set tracking information for this branch you can do so with: git branch --set-upstream new origin/<branch> I want git pull to only update the master branch and leave my current branch alone (it's a tag anyway). Is something like this possible?

How to get back to most recent version in Git?

非 Y 不嫁゛ 提交于 2019-12-02 13:49:48
I have recently moved from SVN to Git and am a bit confused about something. I needed to run the previous version of a script through a debugger, so I did git checkout <previous version hash> and did what I needed to do. Now I want to get back to the newest version, but I don't know the hash for it. When I type git log , I don't see it. How can I do this? Also, is there an easier way to change versions than by typing out hashes - something like "go back two versions" or "go to the most chronologically recent"? git checkout master should do the trick. To go back two versions, you could say

How can I checkout a branch while ensuring that none of my current branch's changes are carried over?

北城以北 提交于 2019-12-02 09:45:50
问题 I want switch branches and have git always set the working directory contents to reflect the state of the branch I'm switching to. I'm experiencing the behaviors stated here https://web.archive.org/web/20160331103129/http://www.gitguys.com/topics/switching-branches-without-committing - git is making a decision** on whether to carry certain files from the working directory associated with my current branch to the branch I switch to. ** This seems to conflict with what's stated here https://www

Does git checkout update all files?

一曲冷凌霜 提交于 2019-12-01 17:59:00
Newb question, I want to make sure I understand this. When I git checkout <revision> , does this return the entire project to its state at that moment, or does it only recreate the files changed in that particular revision? For example: If my folder was completely empty besides the .git repo, and I git checkout master , will the resulting files be the project in its entirety, or only the files changed in the most recent commit? I ask, because I am checking out my project at various points (starting from the beginning), and instead of the project slowly growing in size as one would expect, the

how can git checkout HEAD~2 go 10 commits back

回眸只為那壹抹淺笑 提交于 2019-12-01 14:47:35
There's a remote branch my-issue-branch and a local branch of the same name. We performed git pull --rebase to get the latest commits locally, but the two last commits are breaking the build. We want to go 2 commits back to build the project and do git checkout HEAD~2 which takes us about 10 commits back, instead of just two. Only git checkout <commit-hash> helps the situation. Keeping in mind, that four people work on this branch, what can be wrong? Here's a simplified diagram: ...--o--*-----o------o--o <-- you are here \ / o--o--o--o You are at the marked commit, towards the right. You need