FAQ

IndexTagsArchivesAbout
  • Depend on a branch or tag using a git URL in a package.json?

    2022-02-27

    Question Say I've forked a node module with a bugfix and I want to use my fixed version, on a feature branch of course, until the bugfix is merged and released. How would I reference my fixed version in the dependencies of my package.json? Answer Solution 1 From the npm docs, using a git URL: https://github.com/<user>/<project>.git#<branch> https://github.com/<user>/<project>.git#feature/<branch> Don't use git:// protocol for GitHub, it is not longer supported Solution 2 As of NPM version 1.…

    #git

  • Download a single folder or directory from a GitHub repo

    2022-02-27

    Question How can I download only a specific folder or directory from a remote Git repo hosted on GitHub? Say the example GitHub repo lives here: git@github.com:foobar/Test.git Its directory structure: Test/ ├── foo/ │ ├── a.py │ └── b.py └── bar/ ├── c.py └── d.py I want to download only the foo folder and not clone the whole Test project. Answer Update Apr. 2021: there are a few tools created by the community that can do this for you:…

    #git

  • How can I get a list of Git branches, ordered by most recent commit?

    2022-02-27

    Question I want to get a list of all the branches in a Git repository with the "freshest" branches at the top, where the "freshest" branch is the one that's been committed to most recently (and is, therefore, more likely to be one I want to pay attention to). Is there a way I can use Git to either (a) sort the list of branches by latest commit, or (b) get a list of branches together with each one's last-commit date, in some kind of machine-readable format?…

    #git

  • How to undo a git merge with conflicts

    2022-02-27

    Question I am on branch mybranch1. mybranch2 is forked from mybranch1 and changes were made in mybranch2. Then, while on mybranch1, I have done git merge --no-commit mybranch2 It shows there were conflicts while merging. Now I want to discard everything (the merge command) so that mybranch1 is back to what it was before. I have no idea how do I go about this. Answer Latest Git: git merge --abort This attempts to reset your working copy to whatever state it was in before the merge.…

    #git

  • In Git, what is the difference between origin/master vs origin master?

    2022-02-26

    Question I know, origin is a term for the remote repository and master is the branch there. I am purposely omitting the "context" here and I am hoping that the answer should not depend upon the context. So in git command lines, what is the difference between origin/master and origin master. Is there a non-ambiguous way to understand when to use origin/master and when I should use origin master? Answer (Note: When this question was originally posted, "…

    #git

  • Why do I have to "git push --set-upstream origin "?

    2022-02-25

    Question I created a local branch for testing Solaris and Sun Studio. I then pushed the branch upstream. After committing a change and attempting to push the changes: $ git commit blake2.cpp -m "Add workaround for missing _mm_set_epi64x" [solaris 7ad22ff] Add workaround for missing _mm_set_epi64x 1 file changed, 5 insertions(+) $ git push fatal: The current branch solaris has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin solaris Why do I have to do something special for this?…

    #git

  • Create empty branch on GitHub

    2022-02-23

    Question I want to create a new GitHub branch, called release. This branch needs to be empty! However, there is an existing branch with x commits and I don't want to have its commit history. The only method I found is to create a local --orphan branch. Answer November 2021 Update: As of git version 2.27, you can now use git switch --orphan <new branch> to create an empty branch with no history.…

    #git

  • «
  • 136
  • 137
  • 138
  • 139
  • 140
  • »

©2023 hugo-notepadium-mod

CC BY-NC-SA 4.0 | RSS

Powered by Hugo and the Notepadium-mod

^ TOP ^