top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration
Print Preview

possibility to set an "intend-to-edit" flag on a file in Git

0 votes

we're evaluating Git to be used in our companies Tool. But a hard requirement is the possibility to set an "intend-to-edit" flag on a file (better path). Notice that I did not use the word "lock"! :-)

One easy implementation might be a special branch "XYZ-locks" that contains an empty blob for every flagged file. So our tool just needs to check, whether a blob exists for the path that's intended to edit, tries to push a commit that touches the file and only allows editing if the push succeeds.

Does anybody have a better idea, maybe with notes?

posted Jul 4, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

+1 vote

In my experience everyone who thinks this is a hard requirement is wrong.

Sure you can implement something to do this, but more likely than not you think you need it because your current centralized SCM does it and you think you can't live without it.

I work with a couple of hundred devs all grinding on the same repository and it's really rare to have:

  • People who edit the same code within each other's pull/push window AND
  • Have the edits to those files not be smoothly resolved by automatic merging (i.e. because it was to completely different parts of the file).

When it does happen every once in a while it's trivial to solve it, you just resolve conflicts, talk to the other guy etc.

Why don't you just start using Git and see if this becomes a practical problem rather than devising some elaborate solution to work around something that probably won't be an issue anyway?

answer Jul 4, 2013 by anonymous
Similar Questions
+1 vote

When on a CIFS filesystem a git checkout does not replicate the executable flag from the repository:

 $ git clone git://git/abettersqlplus
 Cloning into 'abettersqlplus'...
 remote: Counting objects: 522, done.
 remote: Compressing objects: 100% (342/342), done.
 remote: Total 522 (delta 166), reused 522 (delta 166)
 Receiving objects: 100% (522/522), 82.40 KiB, done.
 Resolving deltas: 100% (166/166), done.
 $ ls -l abettersqlplus/
 -rw-rw-r-- 1 aesser geneity 45860 May 29 14:46 abettersqlplus/

Subsequently git status reports the file as changed:

 $ cd abettersqlplus/
 $ git status
 # On branch master
 # Changes not staged for commit:
 # (use "git add ..." to update what will be committed)
 # (use "git checkout -- ..." to discard changes in working directory)
 # modified:

no changes added to commit (use "git add" and/or "git commit -a")
If I set the x-flag manually, all is well:

 $ chmod +x
 $ git status
 # On branch master

nothing to commit (working directory clean)

This problem doesn't occur on ext3 or NFS file systems. Client is Ubuntu 12.04 with git version CIFS is exported from Ubuntu 12.04 with Samba version 3.6.3.

Since git recognises the x-flag on this CIFS file system, shouldn't it also be able to set it on checkout?

+1 vote

At some point I added a large file into a git repository. It now exists on multiple branches, possibly with some changes to it. I'd like to remove it from git, but leave its current form (say the one on the master branch) on the file system.

I tried (on a dummy git archive)

git filter-branch --index-filter 'git rm --cached --ignore-unmatch bigfile' master branch1 branch2

That, however, does not leave a copy of bigfile on the file system.It isn't clear to me why not, though the description of the --tree-filteroption to filter-branch (I'm using the --index-filter option, but is is "similar") states:" (new files are auto-added, disappeared files are auto-removed ... )".
Is there a direct way to do what I want, with git? I've found similar requests;none of the responses point out that the above command actually deletes the file from the file system.

0 votes

I want to retrieve the commit history of a given file.What command should I issue? I expect the command like below.

D:GitTest> git show --commit-history test.txt
+2 votes

I normally use git on linux, though I have an installation on a Windows 7 laptop.When using it yesterday to clone a repository on my linux machine, the clonewould open with one of the files modified. I could not undo the modification. Repeated cloning would do the same thing. I then tried cloning from the originalrepo, but using a linux partition on that laptop. It worked fine. Any idea why theWindows git doesn't work?

Useful Links with Similar Problem
Contact Us
+91 9880187415
#470/147, 3rd Floor, 5th Main,
HSR Layout Sector 7,
Bangalore - 560102,
Karnataka INDIA.