Git - Difference Between 'assume-unchanged' and 'skip-worktree'
2022-12-23
Question I have local changes to a file that I don't want to commit to my repository. It is a configuration file for building the application on a server, but I want to build locally with different settings. Naturally, the file always shows up when I do 'git status' as something to be staged. I would like to hide this particular change and not commit it. I won't make any other changes to the file.…
How do I revert my changes to a git submodule?
2022-12-23
Question I have a git submodule (RestKit) which I have added to my repo. I accidentally changed some files in there and I'd like to go back to the source version. In order to do that, I tried to run Mac:app-ios user$ git submodule update RestKit But as you can see here, this did not work as it is still "modified content": Mac:app-ios user$ git status ... # modified: RestKit (modified content) Even Mac:app-ios user$ git submodule update -f RestKit doesn't revert locally modified files.…
Search code inside a Github project
2022-12-21
Question Is there a way to grep for something inside a Github project's code? I could pull the source and grep it locally, but I was wondering if it's possible through the web interface or a 3rd-party alternative. Ideas? Answer Update May 2023: The new code search and code view is now generally available (May. 2023) At GitHub Universe last year, we announced a total redesign of GitHub's code search and navigation experience, powered by our all-new code search engine that we built from scratch.…
When do you use Git rebase instead of Git merge?
2022-12-21
Question When is it recommended to use Git rebase vs. Git merge? Do I still need to merge after a successful rebase? Answer Short Version Merge takes all the changes in one branch and merges them into another branch in one commit. Rebase says I want the point at which I branched to move to a new starting point So when do you use either one? Merge Let's say you have created a branch for the purpose of developing a single feature.…
Convert Mercurial project to Git [duplicate]
2022-12-20
Question This question already has answers here: </div> Converting Mercurial folder to a Git repository (8 answers) Closed 4 years ago. I need to convert a mercurial project to a git project, but I would like to keep the commit history intact. My current solution was to just remove hg related files and then git init && add manually the files I needed, but that would not keep the history. Are there any solutions to this?…
How would I extract a single file (or changes to a file) from a git stash?
2022-12-20
Question Is it possible to extract a single file or diff of a file from a git stash without popping the stash changeset off? Answer On the git stash manpage you can read (in the "Discussion" section, just after "Options" description) that: A stash is represented as a commit whose tree records the state of the working directory, and its first parent is the commit at HEAD when the stash was created.…
Undo git pull, how to bring repos to old state
2022-12-18
Question Is there any way to revert or undo git pull so that my source/repos will come to old state that was before doing git pull ? I want to do this because it merged some files which I didn't want to do so, but only merge other remaining files. So, I want to get those files back, is that possible? EDIT: I want to undo git merge for clarification. After seeing some answers, I did this git reflog bb3139b.…