FAQ

IndexTagsArchivesAbout
  • Apply .gitignore on an existing repository already tracking large number of files

    2023-04-01

    Question I have an existing Visual Studio project in my repository. I recently added a .gitignore file under my project and I assume that tells Git to ignore the files listed in the file. My problem is that all those files are already being tracked and as far as I know Git will not ignore a file that was already tracked before a rule was added to this file to ignore it.…

    #git

  • Clone contents of a GitHub repository (without the folder itself)

    2023-04-01

    Question I'd like to git clone the contents of a repository I have on GitHub. When I git clone (git@github:me/name.git...) I get a folder called name/ and inside name I have my contents... How do I get JUST the contents? Answer If the current directory is empty, you can do that with: git clone git@github.com:me/name.git . (Note the . at the end to specify the current directory.) Of course, this also creates the .…

    #git

  • Git: Find the most recent common ancestor of two branches

    2023-04-01

    Question How to find the most recent common ancestor of two Git branches? Answer You are looking for git merge-base. Usage: $ git merge-base branch2 branch3 050dc022f3a65bdc78d97e2b1ac9b595a924c3f2

    #git

  • Move branch pointer to different commit without checkout

    2023-04-01

    Question To move the branch pointer of a checked out branch, one can use the git reset --hard command. But how to move the branch pointer of a not-checked out branch to point at a different commit (keeping all other stuff like tracked remote branch)? Answer git branch --force <branch-name> [<new-tip-commit>] If new-tip-commit is omitted, it defaults to the current commit. new-tip-commit can be a branch name (e.g., master, origin/master).

    #git

  • Clone A Private Repository (Github)

    2023-03-31

    Question I have a private repository on Github for a project I'm working on. Until now I had only worked on my home desktop, but I just bought a laptop, and am trying to set it up so that I can work on the project from either computer, and push / pull changes. I added a new SSH key to my Github account for the laptop, and was successful in cloning and making changes to a public test repo that I set up.…

    #git

  • Cannot determine the organization name for this 'dev.azure.com' remote URL

    2023-03-29

    Question So I just updated to a new Visual Studio version and I am no longer able to push/pull from/to my Azure Repo (cloning works fine). The exact error I get is Cannot determine the organization name for this 'dev.azure.com' remote url. ensure the credential.usehttppath configuration value is set, or set the organization name as the user in the remote url '{org}@dev.azure.com'. and only the pull command shows me this error, all the others are failing with git fatal error.…

    #git

  • How can I undo a `git commit` locally and on a remote after `git push`

    2023-03-29

    Question I have performed git commit followed by a git push. How can I revert that change on both local and remote repositories? $ git log commit 364705c23011b0fc6a7ca2d80c86cef4a7c4db7ac8 Author: Michael Silver <Michael Silver@gmail.com> Date: Tue Jun 11 12:24:23 2011 -0700 Answer git reset --hard HEAD~1 git push -f <remote> <branch> (Example push: git push -f origin bugfix/bug123) This will undo the last commit and push the updated history to the remote.…

    #git

  • «
  • 31
  • 32
  • 33
  • 34
  • 35
  • »

©2023 hugo-notepadium-mod

CC BY-NC-SA 4.0 | RSS

Powered by Hugo and the Notepadium-mod

^ TOP ^