<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Version Control and Error Tracking
This tutorial is an showcasing the material collected in the Pro Git book which is avilable for free online. I also draw on a set of excellent Scientific Python Lecture Notes  maintained by Robert Johansson.
Roadmap
Basics
Tutorials
Git
GitHub
Definition
Step1:  Setting Up
Step2:  Recording Changes to the Repository
<img src="images/lifecycle.png">
Step3:  Removing and Moving File
Step4:  Viewing the Commit History
Step5:  Adding a Remote Repository
Let us create a repository called try_git in our GitHub accounts
Step6:  While we are at it, let us check out the class repository.
Step7:  From now on, you will find all class material in this repository.  
Tracking Changes
GitHub allows to visualize changes to files over time.
<img src="images/changes.png">
Tagging
Types
Step8:  Let us take a look at our repository in a repository viewer. We choose gitg and can install it using the Ubuntu Software Center.
Git Branching
A Commit and its Tree
Objects
* Commit
* Tree
* Blobs
<img src="images/commit-and-tree.png">
Commits and their Parents
<img src="images/commits-and-parents.png">
A Branch and its Commit History
A branch is a lightweight movable pointer to one of the commits. The HEAD is an additional pointer to the local branch you are currently working on.
<img src="images/branch-and-history.png">
Creating a New Branch
I ususally create a branch for each feature I would like to add to my research software. Once I satisfied with my implementation I merge the development branch back into master.
Step9:  Switching between Branches
Sometimes I will work on the integration and testing of two new features at the same time. Or, even better, somebody else is adding a feature at the same time. In both cases, I can easily switch between branches.
Step10:  Let us check how the content of the directory change as we move between the different branches.
Step11:  Basic Merging
At some point I am hopefully done with my code improvement and it is time to merge my development branch into master.
Step12:  Let us clean up our branches by deleting testing and keep our repository in good standing.
Step13:  Summary
The use of a version control system allows us to improve our economic research in a variety of ways. In my case, I use Git for all my software projects. The debugging process is speed up considerably as I can track back in time and pin down when I introduced a new error. GitHub allows me to easily collaborate with other researchers (or research assistants) and promote my work to a broader audience. 
Cleanup
Step14:  Miscellaneous
You find some additional resources on version control here.
Formatting
<ASSISTANT_TASK:>
Python Code:
import os
try:
    
    os.mkdir('me')
except OSError:
    
    pass
    
os.chdir('me')
Explanation: Version Control and Error Tracking
This tutorial is an showcasing the material collected in the Pro Git book which is avilable for free online. I also draw on a set of excellent Scientific Python Lecture Notes  maintained by Robert Johansson.
Roadmap
Basics
Tutorials
Git
GitHub
Definition: Version Control is a system that records changes to a file or set of files over time so that you can recall specific versions later.
Implementations
* Local Version Control System
* Centralized Version Control System
* Distributed Version Control System
Local Version Control System
<img src="images/local.png">
Centralized Version Control System
<img src="images/centralized.png">
Distributed Version Control Systems
<img src="images/distributed.png" >
Tools
Git
GitHub
<img src="images/git.jpg">
<img src="images/github.png" >
Let us get started!
End of explanation
%%bash
echo 'How does our directory look like?'
ls -al
git init
echo 'How does our directory look like now?'
ls -al
git status
# Let us create files for tracking.
echo 'My Project' > README
echo 'peisenha' > CONTRIBUTING.md
# Set up our identity
git config --global user.name  "Philipp Eisenhauer"
git config --global user.email "eisenhauer@policy-lab.org"
Explanation: Setting Up
End of explanation
%%bash
git add README
git status
%%bash
git add CONTRIBUTING.md
git commit -a -m'initial'
%%bash
echo 'Philipp Eisenhauer' > CONTRIBUTING.md
%%bash
git status
%%bash
git commit -a -m'changes to contributers'
Explanation: Recording Changes to the Repository
<img src="images/lifecycle.png">
End of explanation
%%bash
# Remove files
git rm README
git status
%%bash
# Move files
git mv CONTRIBUTING.md CONTRIBUTORS.md
git status
%%bash
git commit -m'reorganizing files'
Explanation: Removing and Moving File
End of explanation
%%bash
git log
Explanation: Viewing the Commit History
End of explanation
%%bash
git remote add origin git@github.com:peisenha/try_git.git
git push -u origin master
%%bash
git clone git@github.com:peisenha/try_git.git ../other
Explanation: Adding a Remote Repository
Let us create a repository called try_git in our GitHub accounts
End of explanation
%%bash
git clone git@github.com:softEcon/course.git /home/vagrant/course_material
Explanation: While we are at it, let us check out the class repository.
End of explanation
%%bash
# Create tag
git tag -a v1.0 -m'ouf first tag annotated tag'
%%bash
# List tag
git tag -l
%%bash
# Push to remote repository
git commit -a m'added first tag'
git push origin --tags 
Explanation: From now on, you will find all class material in this repository.  
Tracking Changes
GitHub allows to visualize changes to files over time.
<img src="images/changes.png">
Tagging
Types:
* Lightweight, pointer  to specific commit
* Annotated, lightweight tag with additional information
I use annotated tags to release different versions of my research software. You can check it out an example here.
End of explanation
%%bash
git branch testing
%%bash
git branch -a
%%bash
git log --oneline --decorate
Explanation: Let us take a look at our repository in a repository viewer. We choose gitg and can install it using the Ubuntu Software Center.
Git Branching
A Commit and its Tree
Objects
* Commit
* Tree
* Blobs
<img src="images/commit-and-tree.png">
Commits and their Parents
<img src="images/commits-and-parents.png">
A Branch and its Commit History
A branch is a lightweight movable pointer to one of the commits. The HEAD is an additional pointer to the local branch you are currently working on.
<img src="images/branch-and-history.png">
Creating a New Branch
I ususally create a branch for each feature I would like to add to my research software. Once I satisfied with my implementation I merge the development branch back into master.
End of explanation
%%bash
git checkout testing
echo 'Some information on the project.' > README 
git add README
git commit -a -m'adding project information'
Explanation: Switching between Branches
Sometimes I will work on the integration and testing of two new features at the same time. Or, even better, somebody else is adding a feature at the same time. In both cases, I can easily switch between branches.
End of explanation
%%bash
git checkout master
%%bash
git checkout testing
Explanation: Let us check how the content of the directory change as we move between the different branches.
End of explanation
%%bash
git checkout master
echo 'Some other information on the project.' > README 
git add README
git commit -a -m'adding other project information'
%%bash
git merge master testing
%%bash
git add README
git commit -m'fixed merge conflict'
Explanation: Basic Merging
At some point I am hopefully done with my code improvement and it is time to merge my development branch into master.
End of explanation
%%bash
git branch -d testing
git branch -a
Explanation: Let us clean up our branches by deleting testing and keep our repository in good standing.
End of explanation
import shutil
os.chdir('../')
for dir_ in ['me', '.ipynb_checkpoints', 'other']:
    
    try:
        
        shutil.rmtree(dir_)
        
    except OSError:
        
        pass
Explanation: Summary
The use of a version control system allows us to improve our economic research in a variety of ways. In my case, I use Git for all my software projects. The debugging process is speed up considerably as I can track back in time and pin down when I introduced a new error. GitHub allows me to easily collaborate with other researchers (or research assistants) and promote my work to a broader audience. 
Cleanup
End of explanation
import urllib; from IPython.core.display import HTML
HTML(urllib.urlopen('http://bit.ly/1K5apRH').read())
Explanation: Miscellaneous
You find some additional resources on version control here.
Formatting
End of explanation
<END_TASK>