Skip to content

Commit

Permalink
made attack on titan changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Alcas1 committed Aug 19, 2014
1 parent 8aee7d6 commit 4a91dda
Show file tree
Hide file tree
Showing 2 changed files with 190 additions and 11 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ Don't worry, to be safe, this guide is written in a way that assumes little to n
If you're using Mac OS or a flavor of Linux, then git is likely already installed on your system. However if it's not, or if you're running Windows, go [here](http://git-scm.com/downloads). They give you pretty good instructions.

## Making a repository
Open up terminal, and navigate to a directory where you want to keep your projects. A good place may be ```~/dev``` on Mac/Linux or ```C:/dev``` on Windows. From here, run the command ```git init spiderman```. This will create an empty git repository called 'spiderman'. Git puts this in a folder called 'spiderman' for you. Navigate into this directory by typing ```cd spiderman```. Congratulations, you are now in a git repository!
Open up terminal, and navigate to a directory where you want to keep your projects. A good place may be ```~/dev``` on Mac/Linux or ```C:/dev``` on Windows. From here, run the command ```git init titans```. This will create an empty git repository called ‘titans’. Git puts this in a folder called ‘titans’ for you. Navigate into this directory by typing ```cd titans```. Congratulations, you are now in a git repository!

## Adding files
Here's your first git command: ```git status```. Type that, and git will tell you what the status of your repository is. Right now, it'll tell you that you have nothing to commit. That's because there's nothing in there yet! Let's fix that. We'll make a file called 'uncle_ben.txt' that has the contents 'With great power comes great responsibility.' You can do that with your text editor of choice, or you can type the following:

```echo "With great power comes great responsibility." > uncle_ben.txt```
```echo "On that day, mankind received a grim reminder." > armin.txt```

Now that we have that file, type ```git status``` again. Now it will tell you that you have an **untracked** file called 'uncle_ben.txt'. An untracked file is a file that is not currently being versioned by git. As far as git is concerned, this file doesn't really exist. We can tell git to start tracking it by typing ```git add uncle_ben.txt```. Type ```git status``` again, and you see that git recognizes that you have a new file 'uncle_ben.txt', and it is ready to be **commited**.
Now that we have that file, type ```git status``` again. Now it will tell you that you have an **untracked** file called ‘armin.txt'. An untracked file is a file that is not currently being versioned by git. As far as git is concerned, this file doesn't really exist. We can tell git to start tracking it by typing ```git add armin.txt```. Type ```git status``` again, and you see that git recognizes that you have a new file ‘armin.txt', and it is ready to be **commited**.

## Committing files
A git _commit_ is one of those snapshots we were talking about earlier. It's the current state of your project at a point in time. We can see our list of commits by typing ```git log```. If you do that now, you'll get an error - because we haven't made any commits yet! So let's make one. Type the following command:
Expand All @@ -48,17 +48,17 @@ We've just made a commit! We also gave the commit a **message** of "Initial comm
If you type the command ```git log``` you can see that it is now in our log history. Success!

## Changing files
Now that we have a file being tracked by git, we can make some changes. Let's change uncle_ben.txt to say: "With great power there must also come -- great responsibility!" (which is how the quote originally appeared). You can do this in your editor of choice, or you can type:
Now that we have a file being tracked by git, we can make some changes. Let's change armin.txt to say: "We lived in fear of the Titans and were disgraced to live in these cages we called walls.” . You can do this in your editor of choice, or you can type:

```echo 'With great power there must also come -- great responsibility!' > uncle_ben.txt```
```echo 'We lived in fear of the Titans and were disgraced to live in these cages we called walls.' > armin.txt```

(Note that we had to use single quotes, othewise the terminal wouldn't allow us to use an exclamation point.) Now that we've made a change, type ```git status```. Git tells us that we've modified uncle_ben.txt, and that this is 'not staged for commit', or **unstaged**. If a change is **unstaged** then it will not be captured in our snapshot when we type ```git commit```. In order to have it captured in our snapshot, we must first **stage** it by using the ```git add``` command. Type the following:
(Note that we had to use single quotes, othewise the terminal wouldn't allow us to use an exclamation point.) Now that we've made a change, type ```git status```. Git tells us that we've modified armin.txt, and that this is 'not staged for commit', or **unstaged**. If a change is **unstaged** then it will not be captured in our snapshot when we type ```git commit```. In order to have it captured in our snapshot, we must first **stage** it by using the ```git add``` command. Type the following:

```git add uncle_ben.txt```
```git add armin.txt```

Now type ```git status``` again. Git will now say that this is a 'change to be committed' or **staged**. Now we can type the following:

```git commit -m "Fixed the quote to be the original occurance."```
```git commit -m “Changed the quote to the Grim Reminder.”```

Type ```git log``` and see that we now have two commits in our history!

Expand Down Expand Up @@ -121,13 +121,13 @@ git add swing.txt
Your choice! Now let's commit these by typing ```git commit -m "Added some sweet ASCII art."```

## Going back in time
Let's say that we don't like this new Uncle Ben quote after all. It may be the original, but hey, the movie quote just sounds better. There are a couple of ways to go about getting different versions of files in git, so we'll go through more than one. Let's start by using the ```git checkout``` command.
Let's say that we don't like this new Attack on Titan quote after all. It may be the more ominous, but the first quote just sounds cooler. There are a couple of ways to go about getting different versions of files in git, so we'll go through more than one. Let's start by using the ```git checkout``` command.

Remember how when you type ```git log```, you see this really long string of letters and numbers next to the word 'commit'? That's called a SHA-1 tag (usually pronounced shaw-one). It's the unique identifier for the commit. If we want to get a version of a file at a specific commit, we need that identifier. So, copy the SHA-1 tag of the initial commit. Now type the following:

```git checkout ab2bacee5cad uncle_ben.txt``` (replace ```ab2bacee5cad``` with your SHA-1 tag)
```git checkout ab2bacee5cad armin.txt``` (replace ```ab2bacee5cad``` with your SHA-1 tag)

You'll see that uncle_ben.txt now has the contents of 'With great power comes great responsibility.', just like it did in that version of the file. Cool, huh? Now if you do a ```git status``` you'll see that the change has already been staged for you. You could make a commit and put that file back at the state you wanted it.
You'll see that armin.txt now has the contents of 'On that day, mankind received a grim reminder.', just like it did in that version of the file. Cool, huh? Now if you do a ```git status``` you'll see that the change has already been staged for you. You could make a commit and put that file back at the state you wanted it.

But maybe this isn't what you wanted. Maybe you didn't want to get an old version of the file, but an old version of your entire project. You could reset your whole project back to an earlier state by using the ```git reset --hard``` command. If you wanted to go back to your initial commit, you could type:

Expand Down
Loading

0 comments on commit 4a91dda

Please sign in to comment.