Questions tagged [repository]

Can refer to the data store of a version control system containing the whole history of a project, or to an object that transfers data between the business layer of an application and its data store.

A repository is an object that transfers data between the business layer of an application and its data store. It appears to the developer-user as a factory that generates objects or collections in response to queries. Updated objects and collections can be passed back to the repository for persistence to the data store.

A Repository provides a clean separation between business and persistence logic. Repositories are often used with Object/Relational Management (ORM) frameworks. A repository can simply wrap the methods of an ORM, or it can provide a framework-neutral interface that isolates the business layer of the application from the ORM, allowing the ORM to be replaced at a later date without modification to the business layer.

The Repository Pattern is described by Martin Fowler in Patterns of Enterprise Application Software.

It can also be viewed as a:

  • Software Repository: a storage location from which software packages may be retrieved and installed on a computer.
  • Version Control Repository: an on-disk data structure which stores metadata for a set of files and/or directory structure.

See also:

8107 questions
4757
votes
15 answers

How do I push a new local branch to a remote Git repository and track it too?

I want to be able to do the following: Create a local branch based on some other (remote or local) branch (via git branch or git checkout -b) Push the local branch to the remote repository (publish), but make it trackable so git pull and git push…
Roni Yaniv
  • 49,329
  • 5
  • 17
  • 14
3299
votes
11 answers

Remove a file from a Git repository without deleting it from the local filesystem

My initial commit contained some log files. I've added *log to my .gitignore, and now I want to remove the log files from my repository. git rm mylogfile.log will remove a file from the repository, but will also remove it from the local file…
mveerman
  • 33,863
  • 3
  • 19
  • 14
2529
votes
20 answers

How do you clone a Git repository into a specific folder?

Executing the command git clone git@github.com:whatever creates a directory in my current folder named whatever, and drops the contents of the Git repository into that folder: /httpdocs/whatever/public My problem is that I need the contents of the…
David Smith
  • 33,190
  • 10
  • 40
  • 60
1786
votes
25 answers

How do you merge two Git repositories?

Consider the following scenario: I have developed a small experimental project A in its own Git repo. It has now matured, and I'd like A to be part of larger project B, which has its own big repository. I'd now like to add A as a subdirectory of…
static_rtti
  • 46,349
  • 44
  • 123
  • 180
1577
votes
20 answers

How do I clone a subdirectory only of a Git repository?

I have my Git repository which, at the root, has two sub directories: /finisht /static When this was in SVN, /finisht was checked out in one place, while /static was checked out elsewhere, like so: svn co…
Nick Sergeant
  • 29,184
  • 12
  • 34
  • 44
1364
votes
39 answers

Download a single folder or directory from a GitHub repo

How can I download only a specific folder or directory from a remote Git repo hosted on GitHub? Say the example GitHub repo lives here: git@github.com:foobar/Test.git Its directory structure: Test/ ├── foo/ │ ├── a.py │ └── b.py └── bar/ …
g_inherit
  • 13,661
  • 3
  • 13
  • 5
699
votes
12 answers

How do I rename both a Git local and remote branch name?

I have four branches like master -> origin/regacy, FeatureA -> origin/FeatureA. As you can see, I typed the wrong name. So I want to rename a remote branch name (origin/regacy → origin/legacy or origin/master) I try the command below: git remote…
JayD
  • 7,483
  • 5
  • 11
  • 14
663
votes
9 answers

What is the difference between GitHub and gist?

What is the purpose of gist and how is it different from regular code sharing/maintaining using GitHub?
NSExplorer
  • 10,421
  • 11
  • 45
  • 60
612
votes
18 answers

How should I deal with "package 'xxx' is not available (for R version x.y.z)" warning?

I tried to install a package, using install.packages("foobarbaz") but received the warning Warning message: package 'foobarbaz' is not available (for R version x.y.z) Why doesn't R think that the package is available? See also these questions…
Richie Cotton
  • 107,354
  • 40
  • 225
  • 343
518
votes
16 answers

How to move files from one git repo to another (not a clone), preserving history

Our Git repositories started out as parts of a single monster SVN repository where the individual projects each had their own tree like so: project1/branches /tags /trunk project2/branches /tags /trunk Obviously, it…
ebneter
  • 18,039
  • 9
  • 27
  • 30
504
votes
24 answers

How to count total lines changed by a specific author in a Git repository?

Is there a command I can invoke which will count the lines changed by a specific author in a Git repository? I know that there must be ways to count the number of commits as Github does this for their Impact graph.
Gav
  • 9,908
  • 7
  • 30
  • 35
490
votes
9 answers

Untrack files from git temporarily

I have setup a local git on my machine. When I initialized git, I added pre-compiled libs and binaries. However, now during my development I don't want to check in those files intermittently. I dont want to remove these files from repo. Is there any…
agent.smith
  • 8,106
  • 8
  • 32
  • 45
348
votes
12 answers

How do I rename a repository on GitHub?

I wanted to rename one of my repositories on GitHub, but I got scared when a big red warning said: We will not set up any redirects from the old location You will need to update your local repositories to point to the new location Renaming may…
rabbid
  • 4,555
  • 5
  • 24
  • 34
315
votes
11 answers

Proper Repository Pattern Design in PHP?

Preface: I'm attempting to use the repository pattern in an MVC architecture with relational databases. I've recently started learning TDD in PHP, and I'm realizing that my database is coupled much too closely with the rest of my application. I've…
Jonathan
  • 16,121
  • 10
  • 51
  • 54
303
votes
8 answers

How to generate a Dockerfile from an image?

Is it possible to generate a Dockerfile from an image? I want to know for two reasons: I can download images from the repository but would like to see the recipe that generated them. I like the idea of saving snapshots, but once I am done it would…
user1026169
  • 4,067
  • 5
  • 17
  • 25
1
2 3
99 100