FAQ

IndexTagsArchivesAbout
  • Visualizing branch topology in Git

    2023-08-03

    Question I'm playing with Git in isolation on my own machine, and I find it difficult to maintain a mental model of all my branches and commits. I know I can do a git log to see the commit history from where I am, but is there a way to see the entire branch topography, something like these ASCII maps that seem to be used everywhere for explaining branches? .-A---M---N---O---P / / / / / I B C D E \ / / / / `-------------' It just feels like someone coming along and trying to pick up my repository would have difficulty working out exactly what was going on.…

    #git

  • How do I make Git forget about a file that was tracked, but is now in .gitignore?

    2023-08-02

    Question I put a file that was previously being tracked by Git onto the .gitignore list. However, the file still shows up in git status after it is edited. How do I force Git to completely forget the file? Answer .gitignore will prevent untracked files from being added (without an add -f) to the set of files tracked by Git. However, Git will continue to track any files that are already being tracked.…

    #git

  • How to git reset --hard a subdirectory

    2023-08-02

    Question UPDATE²: With Git 2.23 (August 2019), there's a new command git restore that does this, see the accepted answer. UPDATE: This will work more intuitively as of Git 1.8.3, see my own answer. Imagine the following use case: I want to get rid of all changes in a specific subdirectory of my Git working tree, leaving all other subdirectories intact. I can do git checkout . , but git checkout .…

    #git

  • Git fatal: protocol 'https' is not supported

    2023-08-01

    Question I am going through Github's forking guide: https://guides.github.com/activities/forking/ and I am trying to clone the repository onto my computer. However, running the command: $ git clone https://github.com/./Spoon-Knife.git Cloning into 'Spoon-Knife'... fatal: protocol 'https' is not supported Also tried with SSH: $ git clone [email protected]:./Spoon-Knife.git Cloning into 'Spoon-Knife'... Warning: Permanently added the RSA host key for IP address '.' to the list of known hosts. [email protected]: Permission denied (publickey). fatal: Could not read from remote repository.…

    #git

  • How can I move a tag on a git branch to a different commit?

    2023-08-01

    Question I created a tag on the master branch called v0.1 like this: git tag -a v0.1 But then I realized there were still some changes I needed to merge into master for release 0.1, so I did that. But now my v0.1 tag is stuck on (to invoke the post-it note analogy) the wrong commit. I want it to be stuck on the most recent commit on master, but instead it is stuck on the second most recent commit on master.…

    #git

  • How to remove a file from the staging area (= index = cache) in Git?

    2023-08-01

    Question EDIT This question can be understood in two ways, and the optimal answer is different in the two cases. Question 1: I added a previously untracked file to the staging area. How can I remove this file from the staging area without removing it from the file system? Answer 1: Use the following command, as described in John Feminella's answer: git rm --cached <file> Question 2: I modified a file already tracked, and added my modifications to the staging area.…

    #git

  • Git 'error: The branch 'x' is not fully merged'

    2023-07-30

    Question Here are the commands I used from the master branch git branch experiment git checkout experiment Then I made some changes to my files, committed the changes, and pushed the new branch to GitHub. git commit . -m 'changed files' git push -u origin experiment Later on I decided to merge my experiment branch into the master branch. git checkout master git merge experiment Finally I pushed the changes to GitHub.…

    #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 ^