diff --git a/README.md b/README.md index 769893d..50c84f4 100644 --- a/README.md +++ b/README.md @@ -43,22 +43,26 @@ To start: * Return to your web browser and navigate to the lesson you want to download * Click the GitHub icon - + You'll be redirected to the associated github repository like this. - + * **Click the fork button**, as shown above in order to create a copy to your personal account which you can edit and update. After a moment of this: - + You'll be redirected to your new personal copy of the repository: - + ## `git clone` diff --git a/dsc-github-actions-files b/dsc-github-actions-files new file mode 160000 index 0000000..13d7a0a --- /dev/null +++ b/dsc-github-actions-files @@ -0,0 +1 @@ +Subproject commit 13d7a0a0bf46c1fe55a93ae5bd2aef770fe37077 diff --git a/index.ipynb b/index.ipynb index 368448f..6a13b39 100644 --- a/index.ipynb +++ b/index.ipynb @@ -1 +1 @@ -{"cells": [{"cell_type": "markdown", "metadata": {}, "source": ["# Getting Started with Git\n", "\n", "## Introduction \n", "As you now know, Git is a version control system. The Learn platform at Flatiron school has a deep integration with Git and GitHub. GitHub is an online hosting platform that uses Git. We need to teach you just enough Git to interact with GitHub like a real developer. While you can run Python notebooks on the Learn platform itself, you'll also want to be able to download material to your local computer so you can work on it there.\n", "\n", "## Objectives\n", "\n", "You will be able to:\n", "\n", "* Describe the difference between a forked and a cloned respository\n", "* Use `git clone` to clone a repository\n", "* Use `git add`, `git commit`, and `git push` to make changes to a repository\n", "* Compare local and remote repositories\n", "\n", "\n", "## Some terminology and concepts\n", "\n", "As you can see from the objectives above, we're going to dive in and use several Git commands in this lesson. \n", "\n", "The first thing we'll look at is *forking*, a concept from the GitHub platform.\n", "\n", "Forking is the process of making a personal copy of the Learn lab on GitHub. It's basically how you tell Learn that you have started working on a lab.\n", "\n", "![What's a Fork](http://ironboard-curriculum-content.s3.amazonaws.com/front-end/lab-assets/git-workflow-1.png)\n", " \n", "Afterward, we'll then use `git clone` from a bash shell like terminal or git bash in order to copy the material from the web to our local computer.\n", "\n", "From there, Git will allow us to continue to track and incorporate changes that we make to our work. \n", "\n", "`git status` allows us to see if we have made any changes.\n", "\n", "If we have made changes that we would like to save to our version control history, we can then use `git add` to add the changed files to the version history and `git commit` to finalize the process. Finally, we can then use `git push` to push our changes to the web so that we or collaborators can access them from anywhere. \n", "\n", "Now that you have a brief overview of what we're about to dive into, let's go through the process step by step.\n", "\n", "## Open up a Bash Shell and Create a Course Folder / Subfolder\n", "\n", "To use Git, we're going back to the bash shell (mac: terminal, windows: git bash) once again!\n", "To start:\n", "\n", "* Create a folder on your computer for your course materials and navigate into it (preferably using `mkdir` and `cd`) \n", "* Then create a subfolder titled \"Section1\", \"Bash_and_Git\" (or whatever you find to be an appropriate title) and navigate into that \n", "* Return to your web browser and navigate to the lesson you want to download \n", "* Click the GitHub icon\n", "\n", "\n", "\n", "\n", "You'll be redirected to the associated github repository like this. \n", "\n", "\n", "* **Click the fork button**, as shown above in order to create a copy to your personal account which you can edit and update.\n", "\n", "After a moment of this:\n", "\n", "\n", "\n", "\n", "You'll be redirected to your new personal copy of the repository:\n", "\n", "\n", "\n", "## `git clone`\n", "\n", "Now that you have your own copy (by forking), we're going to download this copy to your local computer using `git clone`.\n", "\n", "* Copy the URL \n", " * Mac: Press **cmd+L** to highlight the url bar and **cmd+c** to copy the url\n", " * Windows: Press **Ctrl+L** to highlight the url bar and **Ctrl+c** to copy the url\n", "\n", "* Return to your bash shell\n", "\n", "* Type: **git clone** and paste your repo url (**cmd + v** or **Ctrl+V**)\n", "\n", "** Voila! **\n", "\n", "The repository and all of its contents will be downloaded locally to your computer!\n", "\n", "You should be able to see the new folder by listing the files in the current directory with `ls`. \n", "You can then navigate into the git directory with `cd directory_name`.\n", "\n", "Now that you have a local copy, we can further investigate some more Git commands for version control. **Note that for these to work you must be in the git folder (the one you just cloned above). Make sure to navigate into the folder using the `cd` command.**\n", "\n", "## `git status`\n", "\n", "Once you have a Git repository downloaded locally, Git will keep track of every change you make to the code in that folder. You can ask Git what the differences or changes you've made since the last commit by typing `git status` into your terminal.\n", "\n", "It's really helpful to constantly get the status from Git to see what changes you need to stage, add, commit, or push.\n", "\n", "## `git add`\n", "\n", "Adding changes with the `git add` command is a way to stage any changes and get them ready to be a permanent record in your Git log via a commit. The workflow worth memorizing right now is to simply add all your changes via `git add .`.\n", "\n", "## `git commit`\n", "\n", "A commit is a permanent moment in time in your Git history. A commit creates a new version of your code. To commit, memorize this command. `git commit -am \"Your commit message\"`. You are using the `git commit` command with the flags `-am`, which tell Git to commit all the changes and to include a commit message. You supply the commit message in `\"\"` directly in the command, `\"Your commit message\"`.\n", "\n", "\n", "## `git push`\n", "\n", "Pushing is the process of taking your local code and commits and syncing them, or uploading them, to GitHub. You're updating the GitHub remote (remotes are just fancy names for copies of the repository), generally your fork, represented by a remote named `origin`, by pushing your code to the remote. The Git command to do this is simply `git push`. When you `git push` from within a Git repository, it will take all the commits that you have locally and push them to the online remote.\n", "\n", "\n", "## Additional Resources\n", "\n", "- [Git Cheatsheet](https://www.git-tower.com/blog/git-cheat-sheet/) \n", "\n", "- [Git Best Practices](https://www.git-tower.com/learn/git/ebook/en/command-line/appendix/best-practices) \n", "\n", "- [Understanding the GitHub Flow](https://guides.github.com/introduction/flow) \n", "\n", "- [Hello World GitHub](https://guides.github.com/activities/hello-world) \n", "\n", "- [Forking on GitHub](https://guides.github.com/activities/forking) \n", "\n", "- [Git - The Simple Guide](http://rogerdudler.github.io/git-guide/) \n", "\n", "- [Git Immersion](http://gitimmersion.com/) \n", "\n", "- [Try Git](http://try.github.com/) \n", "\n", "

View Enough Git for Learn on Learn.co and start learning to code for free

\n", "\n", "## Summary\n", "\n", "In this lesson, we took an introductory look at Git and GitHub. First, we saw how to fork and clone repositories from Learn onto your local machine. From there, we then further discussed how to add changes to git, commit them, and push them online."]}], "metadata": {"kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"}, "toc": {"base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, "toc_window_display": false}}, "nbformat": 4, "nbformat_minor": 2} \ No newline at end of file +{"cells": [{"cell_type": "markdown", "metadata": {}, "source": ["# Getting Started with Git\n", "\n", "## Introduction \n", "As you now know, Git is a version control system. The Learn platform at Flatiron school has a deep integration with Git and GitHub. GitHub is an online hosting platform that uses Git. We need to teach you just enough Git to interact with GitHub like a real developer. While you can run Python notebooks on the Learn platform itself, you'll also want to be able to download material to your local computer so you can work on it there.\n", "\n", "## Objectives\n", "\n", "You will be able to:\n", "\n", "* Describe the difference between a forked and a cloned respository\n", "* Use `git clone` to clone a repository\n", "* Use `git add`, `git commit`, and `git push` to make changes to a repository\n", "* Compare local and remote repositories\n", "\n", "\n", "## Some terminology and concepts\n", "\n", "As you can see from the objectives above, we're going to dive in and use several Git commands in this lesson. \n", "\n", "The first thing we'll look at is *forking*, a concept from the GitHub platform.\n", "\n", "Forking is the process of making a personal copy of the Learn lab on GitHub. It's basically how you tell Learn that you have started working on a lab.\n", "\n", "![What's a Fork](http://ironboard-curriculum-content.s3.amazonaws.com/front-end/lab-assets/git-workflow-1.png)\n", " \n", "Afterward, we'll then use `git clone` from a bash shell like terminal or git bash in order to copy the material from the web to our local computer.\n", "\n", "From there, Git will allow us to continue to track and incorporate changes that we make to our work. \n", "\n", "`git status` allows us to see if we have made any changes.\n", "\n", "If we have made changes that we would like to save to our version control history, we can then use `git add` to add the changed files to the version history and `git commit` to finalize the process. Finally, we can then use `git push` to push our changes to the web so that we or collaborators can access them from anywhere. \n", "\n", "Now that you have a brief overview of what we're about to dive into, let's go through the process step by step.\n", "\n", "## Open up a Bash Shell and Create a Course Folder / Subfolder\n", "\n", "To use Git, we're going back to the bash shell (mac: terminal, windows: git bash) once again!\n", "To start:\n", "\n", "* Create a folder on your computer for your course materials and navigate into it (preferably using `mkdir` and `cd`) \n", "* Then create a subfolder titled \"Section1\", \"Bash_and_Git\" (or whatever you find to be an appropriate title) and navigate into that \n", "* Return to your web browser and navigate to the lesson you want to download \n", "* Click the GitHub icon\n", "\n", "\n", "\n", "\n", "You'll be redirected to the associated github repository like this. \n", "\n", "\n", "* **Click the fork button**, as shown above in order to create a copy to your personal account which you can edit and update.\n", "\n", "After a moment of this:\n", "\n", "\n", "\n", "\n", "You'll be redirected to your new personal copy of the repository:\n", "\n", "\n", "\n", "## `git clone`\n", "\n", "Now that you have your own copy (by forking), we're going to download this copy to your local computer using `git clone`.\n", "\n", "* Copy the URL \n", " * Mac: Press **cmd+L** to highlight the url bar and **cmd+c** to copy the url\n", " * Windows: Press **Ctrl+L** to highlight the url bar and **Ctrl+c** to copy the url\n", "\n", "* Return to your bash shell\n", "\n", "* Type: **git clone** and paste your repo url (**cmd + v** or **Ctrl+V**)\n", "\n", "** Voila! **\n", "\n", "The repository and all of its contents will be downloaded locally to your computer!\n", "\n", "You should be able to see the new folder by listing the files in the current directory with `ls`. \n", "You can then navigate into the git directory with `cd directory_name`.\n", "\n", "Now that you have a local copy, we can further investigate some more Git commands for version control. **Note that for these to work you must be in the git folder (the one you just cloned above). Make sure to navigate into the folder using the `cd` command.**\n", "\n", "## `git status`\n", "\n", "Once you have a Git repository downloaded locally, Git will keep track of every change you make to the code in that folder. You can ask Git what the differences or changes you've made since the last commit by typing `git status` into your terminal.\n", "\n", "It's really helpful to constantly get the status from Git to see what changes you need to stage, add, commit, or push.\n", "\n", "## `git add`\n", "\n", "Adding changes with the `git add` command is a way to stage any changes and get them ready to be a permanent record in your Git log via a commit. The workflow worth memorizing right now is to simply add all your changes via `git add .`.\n", "\n", "## `git commit`\n", "\n", "A commit is a permanent moment in time in your Git history. A commit creates a new version of your code. To commit, memorize this command. `git commit -am \"Your commit message\"`. You are using the `git commit` command with the flags `-am`, which tell Git to commit all the changes and to include a commit message. You supply the commit message in `\"\"` directly in the command, `\"Your commit message\"`.\n", "\n", "\n", "## `git push`\n", "\n", "Pushing is the process of taking your local code and commits and syncing them, or uploading them, to GitHub. You're updating the GitHub remote (remotes are just fancy names for copies of the repository), generally your fork, represented by a remote named `origin`, by pushing your code to the remote. The Git command to do this is simply `git push`. When you `git push` from within a Git repository, it will take all the commits that you have locally and push them to the online remote.\n", "\n", "\n", "## Additional Resources\n", "\n", "- [Git Cheatsheet](https://www.git-tower.com/blog/git-cheat-sheet/) \n", "\n", "- [Git Best Practices](https://www.git-tower.com/learn/git/ebook/en/command-line/appendix/best-practices) \n", "\n", "- [Understanding the GitHub Flow](https://guides.github.com/introduction/flow) \n", "\n", "- [Hello World GitHub](https://guides.github.com/activities/hello-world) \n", "\n", "- [Forking on GitHub](https://guides.github.com/activities/forking) \n", "\n", "- [Git - The Simple Guide](http://rogerdudler.github.io/git-guide/) \n", "\n", "- [Git Immersion](http://gitimmersion.com/) \n", "\n", "- [Try Git](http://try.github.com/) \n", "\n", "

View Enough Git for Learn on Learn.co and start learning to code for free

\n", "\n", "## Summary\n", "\n", "In this lesson, we took an introductory look at Git and GitHub. First, we saw how to fork and clone repositories from Learn onto your local machine. From there, we then further discussed how to add changes to git, commit them, and push them online."]}], "metadata": {"kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"}, "toc": {"base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, "toc_window_display": false}}, "nbformat": 4, "nbformat_minor": 2} \ No newline at end of file