This repository is only a test. Use it for practicing.
Note: Anywhere you see text in angled brackets , replace that text (and the angled brackets) with something appropriate.
-
Navigate to a directory in which you would like to store repositories.
-
Type the following command in the console:
git clone [email protected]:sharris40/SDDTestRepository.git
This will create a folder for the repository and copy all the files to it.
-
Change to the repository.
-
Configure your identity with the commands
git config user.name "<your name>"
andgit config user.email "<[email protected]>"
. If you want your identity to apply to all repositories, add--global
aftergit config
. -
Create a branch with
git branch <my_branch>
. This is your local branch. You will make all changes in this branch. -
Switch to the branch with
git checkout <my_branch>
. You will need to type this whenever you want to make changes. -
Make any changes to the repository. Add, edit, and delete files just as you would any normal files.
-
For any files you added, type
git add <file_path>
. You can add an entire directory by specifying the name of the directory as the file path. -
When you make a change, type
git commit -a -m "<Comment>"
. Write a comment that describes your changes.The
-a
will cause git to detect any files you changed and removed, but it will not catch any new files. This is whygit add
is needed when you add a file. You should do this after every major change you make. If you do not want to commit an edited file, omit the-a
, and manually add the files you do want to commit.Do not make multiple unrelated changes and commit them all at once; commit each change individually.
-
When you have finished making changes, switch back to the main branch with the command
git checkout master
and update it withgit pull
. -
If Git reports that you are already up-to-date, you can merge the changes. Type
git merge <my_branch>
. -
If you received updated files, be careful; someone else made changes while you were working. Luckily, Git is smart about file changes and will usually merge the two versions together. However, there are some conflicts that can occur:
- If two people edit the same line:
git merge
will report a merge conflict. The file will be changed so that it includes both versions of the changes with markers indicating the problematic lines. Edit the file to resolve the conflict, then add it usinggit add
and commit the changes withgit commit
. - If one person edits a file, and another removes it: Decide whether to
add or delete the file, and use
git add
orgit rm
followed by a commit.
GitHub provides some documentation on conflict resolution
[here](https://help.github.com/articles/resolving-a-merge-conflict-from-the-command-line/).
You should also look at the documentation for
[`git merge`](https://git-scm.com/docs/git-merge).
- When you have finished, upload the changes with
git push
.
git clone <repo name>
⇨cd <repo name>
⇨git config user.name "<your name>"
⇨git config user.email "<your e‑mail>"
⇨git branch <branch name>
git checkout <branch name>
⇨ Make changes
⇨git add <new/changed file>
⇨git add <another new/changed file>
⇨ …
⇨git commit [-a] -m "<message>"
⇨ Make more changes
⇨ Make more commits ⇨ …
⇨git checkout master
⇨git pull
⇨git merge <branch name>
⇨ resolve conflicts
⇨git add <file you fixed>
⇨git add <another file you fixed>
⇨ …
⇨git commit -m "<message explaining fixes>"
⇨git push
This file is a special file for GitHub. Any directory containing a README.md
will display some documentation in the GitHub Web page corresponding to the
directory. If you want, practice writing README.md files. They’re written in a
language called Markdown.