FAQ

IndexTagsArchivesAbout
  • How to undo a git pull?

    2023-08-06

    Question I would like to undo my git pull on account of unwanted commits on the remote origin, but I don't know to which revision I have to reset back to. How can I just go back to the state before I did the git pull on the remote origin? Answer Or to make it more explicit than the other answer: git pull whoops? git reset --keep HEAD@{1} Versions of git older than 1.…

    #git

  • How to commit a change with both "message" and "description" from the command line? [duplicate]

    2023-08-05

    Question This question already has answers here: </div> Git/GitHub commit with extended message/description (3 answers) Closed 5 years ago. I can push commits to GitHub via git (on the command line, not the Mac app). When I push commits directly from the GitHub web interface (e.g. quickly fixing a typo), I have the chance to "comment" the commit, and GitHub gives me a commit title and a commit description. I find this very useful.…

    #git

  • How to search in commit messages using command line? [duplicate]

    2023-08-04

    Question This question already has answers here: </div> Closed 10 years ago. Possible Duplicate: How to search through all commits in the repository? Is there a way to search through commit headers using the command line? Answer git log --grep=<pattern> Limit the commits output to ones with log message that matches the specified pattern (regular expression). from git help log.

    #git

  • How to tell which commit a tag points to in Git?

    2023-08-04

    Question I have a bunch of unannotated tags in the repository and I want to work out which commit they point to. Is there a command that that will just list the tags and their commit SHAs? Checking out the tag and looking at the HEAD seems a bit too laborious to me. Update I realized after I went through the responses that what I actually wanted was to simply look at the history leading up to the tag, for which git log <tagname> is sufficient.…

    #git

  • What's the difference between git clone --mirror and git clone --bare

    2023-08-04

    Question The git clone help page has this to say about --mirror: Set up a mirror of the remote repository. This implies --bare. But doesn't go into detail about how the --mirror clone is different from a --bare clone. Answer The difference is that when using --mirror, all refs are copied as-is. This means everything: remote-tracking branches, notes, refs/originals/* (backups from filter-branch). The cloned repo has it all. It's also set up so that a remote update will re-fetch everything from the origin (overwriting the copied refs).…

    #git

  • Why does git revert complain about a missing -m option?

    2023-08-04

    Question So I'm working on a project with other people, and there's multiple github forks being worked on. Someone just made a fix for a problem and I merged with his fork, but then I realized that I could find a better solution. I want to revert the commit I just made. I tried doing this with git revert HEAD but it gave me this error: fatal: Commit <SHA1> is a merge but no -m option was given.…

    #git

  • Check if current directory is a Git repository

    2023-08-03

    Question I am writing a series of scripts for Git management in zsh. How do I check if the current directory is a Git repository? (When I'm not in a Git repo, I don't want to execute a bunch of commands and get a bunch of fatal: Not a git repository responses). Answer You can use: git rev-parse --is-inside-work-tree Which will print 'true' to STDOUT if you are in a git repos working tree.…

    #git

  • 1
  • 2
  • 3
  • 4
  • 5
  • »

©2023 hugo-notepadium-mod

CC BY-NC-SA 4.0 | RSS

Powered by Hugo and the Notepadium-mod

^ TOP ^