5

I just started using github.com and my friend and I are working on a project. How can I pull parts of the project but check out certain files I'm working on so he doesn't work on them. He can still download the files but he won't be able to open or edit them until I upload them back and give permission?

Zoe
  • 27,060
  • 21
  • 118
  • 148
ranzy
  • 169
  • 1
  • 2
  • 8

3 Answers3

3

I suppose you mean lock a file when you edit it. Git won't let you do this and it's not something you need to worry about. Instead, you can both work on the same file and then merge your changes later.

Elbert Alias
  • 1,770
  • 1
  • 16
  • 25
  • As a noob about to enter the world of git, this point is a burning issue for me. Wouldn't that be a time waste? 2 people working on the same issue and one gets rejected so all his work is going down the drain! Is there nothing we can do about this? – Isuru Mar 11 '13 at 11:12
  • I suppose you'd have to communicate who does what. If you use an issue tracker you assign issues before working on them. The thing is you can work on completely separate issues that affect the same file. – Elbert Alias Mar 11 '13 at 20:39
1

If you really want to work that way (i.e: lock files, or at least control when your friend will modify your repo), you can ask your friend to fork your repo.

That way, he/she:

  • will have his/her own copy of said repo
  • will work on any file
  • will rebase first with branches fetched from your repo (added as a remote on his/her fork, as described in GitHub: working with remotes)
  • will make pull request, allowing to decide what to include and when.
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

Historically version control systems provide a checkin/checkout feature. When you do a checkout, you reserve the artifact. If another person also has the same file checked out, then you get an error when trying to checkin the artifact. Not sure creating another fork is really the equivale