Difference between revisions of "Using Git Example"
From Genome Analysis Wiki
Jump to navigationJump to searchLine 16: | Line 16: | ||
ls | ls | ||
|[[Image:CreateNewGitRepository.png]] | |[[Image:CreateNewGitRepository.png]] | ||
+ | |} | ||
+ | |||
+ | == Create Working Repositories == | ||
+ | For this example, we are going to create 2 working repositories. | ||
+ | |||
+ | This is so you can see how changes don't affect the other repositories unless pushes & pulls are done. | ||
+ | |||
+ | {| border="1" | ||
+ | |valign="top"| | ||
+ | === Create a Working Repository === | ||
+ | These steps will create a new working repository called learningGit in ~/code/learnGit/ that is a clone of ~/code/learnGit/bareRepo/learningGit. | ||
+ | |||
+ | # Move to the appropriate directory | ||
+ | # Clone the initial repository | ||
+ | # Move into the working directory | ||
+ | # Look at the contents (Note: learningGit has not yet had any files added to it) | ||
+ | |||
+ | cd ~/code/learnGit | ||
+ | git clone ~/code/learnGit/bareRepo/learningGit | ||
+ | cd learningGit | ||
+ | ls -a | ||
+ | | | ||
+ | [[Image:GitEmptyRepo.png]] | ||
+ | |- | ||
+ | |valign="top"| | ||
+ | === Create a Second Working Repository === | ||
+ | These steps will create a second working repository called learningGit2 in ~/code/learnGit/ that is a clone of ~/code/learnGit/bareRepo/learningGit. | ||
+ | |||
+ | |||
+ | # Move to the appropriate directory | ||
+ | # Clone the initial repository | ||
+ | # Move into the working directory | ||
+ | # Look at the contents (Note: learningGit has not yet had any files added to it) | ||
+ | |||
+ | cd ~/code/learnGit | ||
+ | git clone ~/code/learnGit/bareRepo/learningGit learningGit2 | ||
+ | cd learningGit2 | ||
+ | ls -a | ||
+ | | | ||
+ | [[Image:GitCreate2ndRepo.png]] | ||
+ | |- | ||
|} | |} | ||
Revision as of 08:49, 8 July 2011
Create new Bare Repository
Create Working Repositories
For this example, we are going to create 2 working repositories.
This is so you can see how changes don't affect the other repositories unless pushes & pulls are done.
Create a Working RepositoryThese steps will create a new working repository called learningGit in ~/code/learnGit/ that is a clone of ~/code/learnGit/bareRepo/learningGit.
cd ~/code/learnGit git clone ~/code/learnGit/bareRepo/learningGit cd learningGit ls -a |
|
Create a Second Working RepositoryThese steps will create a second working repository called learningGit2 in ~/code/learnGit/ that is a clone of ~/code/learnGit/bareRepo/learningGit.
cd ~/code/learnGit git clone ~/code/learnGit/bareRepo/learningGit learningGit2 cd learningGit2 ls -a |
Add the First Set of Files to the Repository
There are multiple steps for adding the files:
- Creating a repository with a working directory
- Creating the files
- Staging the files
- Committing the files
- Pushing the files to the bare repository.