There is a file which was already committed and pushed to the repo.  Now I want it to be ignored after initialization, which means that everyone can fetch this file from remote but local change will be ignored  unless ones force-add it again and will not be shown in git status.  It is just like an untraced file except it can be fetch from remote.  I have had some try to solve it.   git rm --cache theFile. The file will be removed from repo by this command and can't be fetched any more. So it's NOT the correct answer. git update-index --assume-unchanged theFile. The file will disappear from git status, which is what I need. But it's a local command. Others should call it manually. Also, the git index will change after some command so ones should call it again. It not quiet fit my demand.   Is there a perfect solution?
73050
Let's say you have a typical web app and with a file configuration.whatever. Every developer working on the project will have one version for their dev boxes, there will be a dev, prod and stage versions. How do you deal with this in source control? Not check in this file at all, check it with different names or do something fancy altogether?
513
I am trying to fetch a log file which is repeatedly updated. I want that updated file, but don't want to download the entire file again and again from the remote system via SCP.  Any idea to achieve this in minimal network usage?
56287
See also:         How can I find out which remote branch a local branch is tracking?  Do I need to parse git config output, or is there a command that would do this for me?
48115
I'm working on a massive Java web application which is kept under centralized version control, but the source files are used to build and run the actual server, which then copies all the files I work on into a random temporary directory while it's running.  My problem is that I need to either rebuild this huge application to see any changes to my files, or keep track of all my changes and copy over the files I've changed back to their source location before committing them back to source control.  My question is: is there a command line script I can run that will monitor any changes in the source folder and automatically copy changed files across to temporary folder X?  The idea is to remove the human point of failure in having to manually mitigate the two-locations problem.
113493
Is there a way to make a file readonly permanently in linux. Or can I put a password to a file to make it readonly, then apply that password again to change its permission, or before they can alter it.
66718
I have a Git repository and I'd like to see how some files looked a few months ago. I found the revision at that date; it's 27cf8e84bb88e24ae4b4b3df2b77aab91a3735d8. I need to see what one file looks like, and also save it as a ("new") file.  I managed to see the file using gitk, but it doesn't have an option to save it. I tried with command-line tools, the closest I got was:  git-show 27cf8e84bb88e24ae4b4b3df2b77aab91a3735d8 my_file.txt   However, this command shows a diff, and not the file contents. I know I can later use something like PAGER=cat and redirect output to a file, but I don't know how to get to the actual file content.  Basically, I'm looking for something like svn cat.
53671
The new  is pretty neat to get the patches created/reviewed/merged. However, if you are using the patch via , we have a few options. Option 1: we can use the MR  to add the patch like this: &quot;drupal/message&quot;: {   &quot;3186091&quot;: &quot;https://git.drupalcode.org/project/message/-/merge_requests/1.patch&quot; }  but it means any new change pushed to the fork/branch, would get automatically added. As the patch file gets pulled on composer install. Option 2: We could use the fork's  and commit hash to keep the patch static, but once the MR merged, the fork might get deleted and breaks the build. Option 3: Obviously we can generate the patch from the MR and upload to the issue comment, but it seems a duplicate effort and hard to keep up with an active core issue (right now, we just need to update the patch file in composer.json or composer.patches.json) Is there a way to have the current patch file behavior in the new fork based issue queue? UPDATE: Both option 1 and (probably) option 3 are documented on
2425
I need to exclude .git from my find search. To achive that, I am using the -path ./.git -prune switch:  $ find . -path ./.git -prune -o \( -type f -o -type l -o -type d \) | grep '.git' ./.git   However, even though this skips the contents of the .git directory, it lists the directory itself. It works when I add -path ./.git -prune -o -print -a  find . -path ./.git -prune -o -print -a \( -type f -o -type l -o -type d \) | grep '.git'   Why is this necessary. I thought that both commands should have same output. The second syntax is quite ugly.
11501
We are currently working in a private beta and so are still in the process of making fairly rapid changes, although obviously as usage is starting to ramp up, we will be slowing down this process.  That being said, one issue we are running into is that after we push out an update with new JavaScript files, the client browsers still use the cached version of the file and they do not see the update.  Obviously, on a support call, we can simply inform them to do a ctrlF5 refresh to ensure that they get the up-to-date files from the server, but it would be preferable to handle this before that time.  Our current thought is to simply attach a version number onto the name of the JavaScript files and then when changes are made, increment the version on the script and update all references.  This definitely gets the job done, but updating the references on each release could get cumbersome.  As I'm sure we're not the first ones to deal with this, I figured I would throw it out to the community.  How are you ensuring clients update their cache when you update your code?  If you're using the method described above, are you using a process that simplifies the change?
5855
I am working on a git repository with a master branch and another topic branch. I have switched to topic branch and modified a file. Now, if I switched to master branch that same file is shown as modified.   For example:  git status in git-build branch:  # On branch git-build # Changes to be committed: #   (use "git reset HEAD &lt;file&gt;..." to unstage) # #       modified:   cvsup_current #   Switch to master branch  [root@redbull builder_scripts (git-build)]# git co master M       builder_scripts/cvsup_current Switched to branch "master"   git status in master branch  [root@redbull builder_scripts (master)]# git status # On branch master # Changes to be committed: #   (use "git reset HEAD &lt;file&gt;..." to unstage) # #       modified:   cvsup_current #   Why is that the file is shown as modified in master branch even though it was modified in git-build branch?   My understanding was that the branches are independent of each other and when I change from one branch to another the changes do not "spill over" from one branch to another. So I am obviously missing some thing here.   Anyone got a clue stick?
69617
I have created two files:  sample.txt and sample.txt  (the second file contains some hidden characters, e.g. a space). How can I remove the latest modified file? I'm using Linux.
73101
Is there a command in Git to see (either dumped to stdout, or in $PAGER or $EDITOR) a particular version of a particular file?
8716
I am looking for a simple Git command that provides a nicely formatted list of all files that were part of the commit given by a hash (SHA-1), with no extraneous information. I have tried: git show a303aa90779efdd2f6b9d90693e2cbbbe4613c1d  Although it lists the files, it also includes unwanted diff information for each. Is there another git command that will provide just the list I want, so that I can avoid parsing it from the git show output?
65861
I want to create a script that whenever there are more than three files being removed, it invokes rm -i by default. I know it will go in initialization files but can't seem to get it working.  So far:  if [$file -ge 3]; then   rm -i    exit 0  else   rm exit 1
20144
I have noticed that some browsers (in particular, Firefox and ) are very zealous in using cached copies of .css and .js files, even between browser sessions. This leads to a problem when you update one of these files, but the user's browser keeps on using the cached copy. What is the most elegant way of forcing the user's browser to reload the file when it has changed? Ideally, the solution would not force the browser to reload the file on every visit to the page.  I have found  and  suggestion to be useful. It turns out there is a term for this: auto-versioning. I have posted a new answer below which is a combination of my original solution and John's suggestion. Another idea that was suggested by SCdF would be to append a bogus query string to the file. (Some Python code, to automatically use the timestamp as a bogus query string, was .) However, there is some discussion as to whether or not the browser would cache a file with a query string. (Remember, we want the browser to cache the file and use it on future visits. We only want it to fetch the file again when it has changed.)
71262
I'm not a git master, but I have been working with it for some time now, with several different projects.  In each project, I always git clone [repository] and from that point, can always git pull, so long as I don't have outstanding changes, of course.  Recently, I had to revert to a previous branch, and did so with git checkout 4f82a29.  When I was again ready to pull, I found that I had to set my branch back to master.  Now, I can not pull using a straight git pull but instead, have to specify git pull origin master, which is annoying, and indicates to me that I don't fully understand what is going on.  What has changed which does not allow me to do a straight git pull without specifying origin master, and how to I change it back?  UPDATE:  -bash-3.1$ cat config [core]     repositoryformatversion = 0     filemode = true     bare = false     logallrefupdates = true [branch "master"] [remote "origin"]     url = git@github.com:user/project.git     fetch = refs/heads/*:refs/remotes/origin/*   UPDATE 2: To be clear, I understand that my original method may have been incorrect, but I need to fix this repo so that I can simply use git pull again.  Currently, git pull results in:  -bash-3.1$ git pull You asked me to pull without telling me which branch you want to merge with, and 'branch.master.merge' in your configuration file does not tell me either.  Please name which branch you want to merge on the command line and try again (e.g. 'git pull  '). See git-pull(1) for details on the refspec.  If you often merge with the same branch, you may want to configure the following variables in your configuration file:      branch.master.remote =      branch.master.merge =      remote..url =      remote..fetch =   See git-config(1) for details.   I can tell git pull which branch to merge, and it works correctly, but git pull does not work as it did originally before my git checkout.
84791
I mistakenly added files to Git using the command:  git add myfile.txt   I have not yet run git commit. Is there a way to undo this, so these files won't be included in the commit?