FAQ

IndexTagsArchivesAbout
  • How can I make git show a list of the files that are being tracked?

    2022-11-12

    Question Using command line git, how can I make git show a list of the files that are being tracked in the repository? Answer If you want to list all the files currently being tracked under the branch master, you could use this command: git ls-tree -r master --name-only If you want a list of files that ever existed (i.e. including deleted files): git log --pretty=format: --name-only --diff-filter=A | sort - | sed '/^$/d'

    #git

  • Reduce git repository size

    2022-11-12

    Question I tried looking for a good tutorial on reducing repo size, but found none. How do I reduce my repo size...it's about 10 MB, but the thing is Heroku only allows 50 MB and I'm no where near finished developing my app. I added the usual suspects (log, vendor, doc etc) to .gitignore already. Although I only added .gitignore recently. Any suggestions? Answer Update Feb. 2021, eleven years later: the new git maintenance command (man page) should supersede git gc, and can be scheduled.…

    #git

  • Git reset single file in feature branch to be the same as in master [duplicate]

    2022-11-11

    Question This question already has answers here: </div> How do I reset or revert a file to a specific revision? (36 answers) Closed 7 years ago. I'm trying to revert my changes in a single file in my feature branch and I want this file to be the same as in master. I tried: git checkout -- filename git checkout filename git checkout HEAD -- filename It seems that none of these made any changes to my feature branch.…

    #git

  • Git: "Corrupt loose object"

    2022-11-11

    Question Whenever I pull from my remote, I get the following error about compression. When I run the manual compression, I get the same: $ git gc error: Could not read 3813783126d41a3200b35b6681357c213352ab31 fatal: bad tree object 3813783126d41a3200b35b6681357c213352ab31 error: failed to run repack Does anyone know, what to do about that? From cat-file I get this: $ git cat-file -t 3813783126d41a3200b35b6681357c213352ab31 error: unable to find 3813783126d41a3200b35b6681357c213352ab31 fatal: git cat-file 3813783126d41a3200b35b6681357c213352ab31: bad file And from git fsck I get this ( don't know if it's actually related):…

    #git

  • How do I prevent 'git diff' from using a pager?

    2022-11-11

    Question Is there a command line switch to pass to git diff and other commands that use the less pager by default? I know these methods exist: git diff | cat... removes all syntax highlighting git config --global core.pager cat sets the pager in the global .gitconfig to cat export GIT_PAGER=cat But I would prefer a command line switch. Answer --no-pager to Git will tell it to not use a pager.…

    #git

  • moving changed files to another branch for check-in

    2022-11-11

    Question This often happens to me: I write some code, go to check in my changes, and then realize I'm not in the proper branch to check in those changes. However I can't switch to another branch without my changes reverting. Is there a way to move changes to another branch to be checked in there? Answer git stash is your friend. If you have not made the commit yet, just run git stash.…

    #git

  • How to unstash only certain files?

    2022-11-10

    Question I stashed my changes. Now I want to unstash only some files from the stash. How can I do this? Answer As mentioned below, and detailed in "How would I extract a single file (or changes to a file) from a git stash?", you can apply use git checkout or git show to restore a specific file. git checkout stash@{0} -- <filename> With Git 2.23+ (August 2019), use git restore, which replaces the confusing git checkout command:…

    #git

  • «
  • 66
  • 67
  • 68
  • 69
  • 70
  • »

©2023 hugo-notepadium-mod

CC BY-NC-SA 4.0 | RSS

Powered by Hugo and the Notepadium-mod

^ TOP ^