FAQ

IndexTagsArchivesAbout
  • gitignore all files of extension in directory

    2022-01-10

    Question Is there a way to ignore all files of a type in a directory? ** is apparently meaningless to git, so this doesn't work: /public/static/**/*.js The idea is to match arbitrary nested folders. Answer It would appear that the ** syntax is supported by git as of version 1.8.2.1 according to the documentation. Two consecutive asterisks ("**") in patterns matched against full pathname may have special meaning: A leading "…

    #git

  • How do I list all the files in a commit?

    2022-01-09

    Question How can I print a plain list of all files that were part of a given commit? Although the following lists the files, it also includes unwanted diff information for each: git show a303aa90779efdd2f6b9d90693e2cbbbe4613c1d Answer Preferred Way (because it's a plumbing command; meant to be programmatic): $ git diff-tree --no-commit-id --name-only bd61ad98 -r index.html javascript/application.js javascript/ie6.js Another Way (less preferred for scripts, because it's a porcelain command; meant to be user-facing)…

    #git

  • How can I merge two commits into one if I already started rebase?

    2022-01-08

    Question I am trying to merge 2 commits into 1, so I followed “squashing commits with rebase” from git ready. I ran git rebase --interactive HEAD~2 In the resulting editor, I change pick to squash and then save-quit, but the rebase fails with the error Cannot 'squash' without a previous commit Now that my work tree has reached this state, I’m having trouble recovering. The command git rebase --interactive HEAD~2 fails with:…

    #git

  • How to fix committing to the wrong Git branch?

    2022-01-08

    Question I just made a perfectly good commit to the wrong branch. How do I undo the last commit in my master branch and then take those same changes and get them into my upgrade branch? Answer If you haven't yet pushed your changes, you can also do a soft reset: git reset --soft HEAD^ This will revert the commit, but put the committed changes back into your index. Assuming the branches are relatively up-to-date with regard to each other, git will let you do a checkout into the other branch, whereupon you can simply commit:…

    #git

  • What's the difference between 'git reset' and 'git checkout'?

    2022-01-08

    Question I've always thought of git reset and git checkout as the same, in the sense that both bring the project back to a specific commit. However, I feel they can't be exactly the same, as that would be redundant. What is the actual difference between the two? I'm a bit confused, as the svn only has svn co to revert the commit. ADDED VonC and Charles explained the differences between git reset and git checkout really well.…

    #git

  • git recover deleted file where no commit was made after the delete

    2022-01-07

    Question I deleted some files. I did NOT commit yet. I want to reset my workspace to recover the files. I did a git checkout .. But the deleted files are still missing. And git status shows: # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # deleted: cc.properties # deleted: store/README # deleted: store/cc.properties # Why doesn't git checkout . reset the workspace to HEAD?…

    #git

  • Default behavior of "git push" without a branch specified

    2022-01-06

    Question I use the following command to push to my remote branch: git push origin sandbox If I say git push origin does that push changes in my other branches too, or does it only update my current branch? I have three branches: master, production and sandbox. The git push documentation is not very clear about this, so I'd like to clarify this for good. Which branches and remotes do the following git push commands update exactly?…

    #git

  • «
  • 156
  • 157
  • 158
  • 159

©2023 hugo-notepadium-mod

CC BY-NC-SA 4.0 | RSS

Powered by Hugo and the Notepadium-mod

^ TOP ^