Resetting remote to a certain commit
2022-03-16
Question I want to discard all changes done after commit <commit-hash> . So I did: git reset --hard <commit-hash> Now I want to do the same with my remote. How can I do this? I have done some commits (and pushes) after <commit-hash> and I just want to discard them all. Is just something went terribly wrong in the way and I don't want to make it worse than it is already.…
git - pulling from specific branch
2022-03-15
Question I have cloned a git repository to my dev server and then switched to the dev branch but now I can't do a git pull to update the branch. How do I update the code on the server ? Answer See the git-pull man page: git pull [options] [<repository> [<refspec>...]] and in the examples section: Merge into the current branch the remote branch next: $ git pull origin next…
Git Server Like GitHub? [closed]
2022-03-15
Question Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. </div> Closed 9 years ago. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.…
Git asks for username every time I push
2022-03-14
Question Whenever I try to push into my repo git asks for both username & password. I have no problem in re-entering my password each time but the problem is in entering username. I use https to clone my repository. So, how can I configure git so that it doesn't asks for username on each git push. I am new to linux but IIRC in windows git push only asks for password.…
GitHub "fatal: remote origin already exists"
2022-03-14
Question I am trying to follow along Michael Hartl's Rails tutorial but I've run across an error. I signed up at GitHub, issued a new SSH key, and created a new repository. But when I enter the next line into the terminal, I get the following error: Parkers-MacBook-Pro:.ssh ppreyer$ git remote add origin git@github.com:ppreyer/first_app.git fatal: remote origin already exists. Just wondered if anybody else has run across this problem? Answer Short version:…
Git: Cherry-Pick to working copy without commit
2022-03-13
Question I have several branches where I keep certain commits that I want to apply to my working copy every now and then. Initially I tried cherry-picking but I do not want to have the commit in the target branch later. So I did cherry-pick + reset HEAD~1 --soft Is there something simpler like cherry-picking to working copy only? Answer Use '-n' flag with the cherry-picking which is "no commit"…
How do I view 'git diff' output with my preferred diff tool/ viewer?
2022-03-12
Question When I type git diff, I want to view the output with my visual diff tool of choice (SourceGear "diffmerge" on Windows). How do I configure git to do this? Answer Since Git1.6.3, you can use the git difftool script: see my answer below. May be this article will help you. Here are the best parts: There are two different ways to specify an external diff tool. The first is the method you used, by setting the GIT_EXTERNAL_DIFF variable.…