From 650f1333683bf801ea6efacd07ee4316fe8c2bd8 Mon Sep 17 00:00:00 2001 From: Kevin Brutus Date: Sun, 29 Sep 2019 16:53:28 -0400 Subject: [PATCH 1/2] start --- README.md | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6629d35..fb37021 100644 --- a/README.md +++ b/README.md @@ -2,33 +2,105 @@ ## First Set 1. Create a new directory on your Desktop called git_exercises and cd into that directory. +``` +mkdir git_excercises +cd git_excercises +``` 2. Using `git init`, create a new repository. +``` +git init +``` 3. Using the `touch` command, create empty files called foo and bar in your repository directory. +``` +touch foo +touch bar +``` 4. Enter `ls` to make sure they were added. +``` +ls +``` 5. Check your `git status`. -6. Using `git add foo`, add `foo` to the staging area. Confirm with `git status` that it worked. +``` +git status +``` +6. Using `git add foo`, add `foo` to the staging area. +``` +git add foo +``` +Confirm with `git status` that it worked. +``` +git status +``` 7. Using `git commit -m` add an appropriate message, add foo to the repository. +``` +git commit -m "foo add" +``` 8. Check your `git status`. +``` +git status +``` 9. Using `git add bar`, add bar to staging area. Confirm with git status that it worked. +``` +git add bar +``` 10. Now run `git commit -m` option, and add the message `“Add bar”`. +``` +git commit -m "add bar" +``` 11. Using `git log`, confirm that the commits made in the previous exercises worked correctly. +``` +git log +``` ## Second Set 1. Use touch to create an empty file called baz. +``` +touch baz +``` 2. Check that it's there by entering `ls`. +``` +ls +``` 3. Check the status of your git. +``` +git status +``` 4. Add baz to the staging area using `git add .`, then commit with the message `"Add bazz"`. +``` +git add . +git commit -m "Add bazz" +``` 5. Realizing there’s a typo in your commit message, change bazz to baz using `git commit --amend -m Add baz`. +``` +git commit --amend -m "Add baz" +``` 6. Run git log to get the id of the last commit, then view the diff using `git show ` to verify that the message was amended properly. +``` +git show +``` ### Third Set 1. The `git log` command shows only the commit messages, which makes for a compact display but isn’t particularly detailed. Verify by running `git log -p` that the `-p` option shows the full diffs represented by each commit. Press `q` to escape. +``` +git log +git log -p +q +``` 2. Create a file `README.md`, add and commit it. +``` +touch README.md +git add . +git commit -m "Add README" +``` 3. Got to github and create a new repository. Connect your local repo to the remote one. +``` + 4. Open your README.md and and add the line `# hello there` at the top of `README.md` and save. +``` + 5. Check the status, then add, check the status, and then commit the new line with a commit message of your choice. Verify using `git status` that the change was committed as expected. 6. Push your changes: `git push origin master`. Refresh your github and click on the commit to verify the changes. From 373130174ac6e28fb33d8c9023f4b433624e2875 Mon Sep 17 00:00:00 2001 From: Kevin Brutus Date: Sun, 29 Sep 2019 17:03:49 -0400 Subject: [PATCH 2/2] up tp set four --- README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fb37021..378110b 100644 --- a/README.md +++ b/README.md @@ -97,12 +97,27 @@ git commit -m "Add README" ``` 3. Got to github and create a new repository. Connect your local repo to the remote one. ``` - +git remote add origin https://github.com/KevinBrutus530/gitlabHW.git +``` 4. Open your README.md and and add the line `# hello there` at the top of `README.md` and save. ``` +code . +'# hello there' +command + s +``` 5. Check the status, then add, check the status, and then commit the new line with a commit message of your choice. Verify using `git status` that the change was committed as expected. +``` +git status +git add . +git status +git commit -m "add text to readme" +git status +``` 6. Push your changes: `git push origin master`. Refresh your github and click on the commit to verify the changes. +``` +git push origin master +``` ### Fourth Set