git-checkout

Git CHMOD post-receive hook

為{幸葍}努か 提交于 2019-12-11 06:20:55
问题 I'm using a bare remote repository on my webserver with a post-receive hook that will automatically push my files in the public_html directory. The problem is, I'm using codeigniter and the index.php file has to be chmod 755. I changed it on the server with filezilla, but after every push the index.php file gets set to 644, which results in an internal server error. This happens even when the index.php isn't changed or stashed.. I've searched for a solution, but so far without luck.. Could

How does git deal with identical branch names from two different remote repo?

China☆狼群 提交于 2019-12-11 03:49:45
问题 If I set up two remote using git remote add for a repo, and the two repo contain a branch with the same name. How does git know which branch of which repo I intend to use when I switch to it using git checkout ? 回答1: How does git know which branch of which repo I intend to use when I switch to it using git checkout? It doesn't. Typically, if there is ambiguity, such as in this situation where both remotes ("origin" and "upstream2") have a devel branch: $ git branch -a * master remotes/origin

Is there a way to refer to a child commit of the current detached HEAD?

心不动则不痛 提交于 2019-12-11 03:44:47
问题 I know how to refer to a parent commit as HEAD^ . But is it possible to refer to a child commit in a similar way? 回答1: The answer is both no and yes, or perhaps "this question makes no sense", depending on what you mean . Your question refers specifically to "a child commit of the current detached HEAD". This is why the question makes no sense, at least not without additional information. As Tim Biegeleisen noted in a comment, when you check out by branch name, this puts you on the tip of the

switching branches in git - when will i get “You have local changes cannot switch branches.”? [duplicate]

大憨熊 提交于 2019-12-11 02:15:23
问题 This question already has answers here : Closed 8 years ago . Possible Duplicates: git: Switch branch and ignore any changes without committing. Git branches behaving strangely I know that the general recommendation is to have a clean status before switching branches in git. ( stash or park-commit ). I'm trying to understand when will I get "You have local changes cannot switch branches" , I can't follow the logic : I have a repo, with a file called version.txt, contains the text "1" : git

`checkout -B` vs. `symbolic-ref`

久未见 提交于 2019-12-11 01:55:08
问题 Are the following commands equivalent? If not, what are the differences? git checkout -B a_branch and git branch -f a_branch HEAD git symbolic-ref HEAD refs/heads/a_branch See also this related post. 回答1: Yes, they are extremely close, so much so that they might as well be identical. You can stop here, the rest is because the above is a special case They become much less close if you change one of them slightly. Consider that you can use this as: git checkout -B name commit-specifier as well

Update **not** the current branch (in Git)

百般思念 提交于 2019-12-10 22:40:51
问题 So I am in branch feature . And I want to rebase w/ branch master . git rebase master And it says that feature branch is up-to-date. Of course it is because master branch hasn't changed — it is the same as in moment when I create feature branch from it. Actually it is not. All I need is to do pull in master branch. git checkout master git pull git checkout feature My question: can't I update master branch w/o checking-out to it? I tried from feature branch: git pull origin master master ..

How to launch a Bash function using Git alias

拈花ヽ惹草 提交于 2019-12-10 20:27:43
问题 I want to use a Git alias in ~/.gitconfig so that it calls a bash function, if it is defined, otherwise call the regular git checkout . This is what I have devised: cat ~/.gitconfig ... [alias] ... co = !(compgen -A function vxzExecuteGitCheckout >/dev/null && vxzExecuteGitCheckout ) || git checkout The problem is that Git uses /bin/sh (which happens to be dash in my case) and it barfs on compgen since it is a bash builtin. Any way making sure that Git uses bash to execute this command? Note

Design goes awry, after checkout to earlier commit on popping stash

孤街醉人 提交于 2019-12-10 20:24:43
问题 My design (html/css) changed/gone awry after I popped back stashed repo. Here is what I did. In order to temporary try out something, I did a git stash Then, checked onto an earlier commit git checkout fd3243d but did not make any changes. Immediately did git stash pop . Now, to my horror (that sinking feeling), when I refreshed design in browser it went totally awry and on the very top it reads <<<<<<< Updated upstream ======= >>>>>>> Stashed changes <<<<<<< Updated upstream ======= >>>>>>>

Getting back code from detached commit with no branch

最后都变了- 提交于 2019-12-10 20:21:52
问题 I have a commit that is not in a branch and it contains all my latest work. I need to add it to the master branch. How can I do this? git status shows this: * (detached from) b225b49 master saved-work Will I lose it if I git checkout master ? 回答1: You're in what git calls "detached HEAD" state. There's a super-easy way to recover: git checkout -b newbranch creates the new branch newbranch and puts you on it, at the current commit (i.e., nothing changes except that you're now "on" a branch

How to do a pre-checkout with Git

岁酱吖の 提交于 2019-12-10 18:44:24
问题 I would like to move some files before doing a git checkout on a specific branch, and to execute some scripts. There is no way to do an alias to checkout with my scripts, I really need a hook. I saw many links and it seems the the pre-checkout hook is not yet implemented. Is there a way to do so? 回答1: you can use git stash that grab your local changes. Usually i do next: git stash -u; git checkout <branch>; git stash pop Execute them in one line with && and you will get way to move your