Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

HELP: You can find some help to solve this section at: https://www.atlassian.com/git/tutorials/setting-up-a-repository/git-clone

  1. Create a new folder in order to store the repository code. Name it repo. It should be a folder where you have read and write permissions (e.g. your HOME)
  2. Open a windows shell ( cmd or GIT CMD ). It might be easier to use the Git Bash if you are familiar with linux commands. 
  3. Using cd command navigate to the folder you want to store your repo. It should be a folder where you have read and write permissions (e.g. your HOME)
  4. Create a new folder in order to store the repository code. Name it repo
  5. In your terminal, move to the repo directory (use cd command). This is the place where we are cloning the repository.
  6. Insert the adequate command to clone the repository. The address of the repository can be found from Github (Clone or Download button).
  7. If everything went correctly, you should now see a directory named gittutorial (might be different if you have changed the name of your directory).
  8. You can now open the different files of your project using your preferred text editor.

...

Creating and removing content from a repository

NOTE: INSTRUCTIONS IN THIS SECTION CAN BE DONE ONLY BY ONE MEMBER OF THE TEAM

Before going on,  you must learn a really important command: git status (more info at https://www.atlassian.com/git/tutorials/inspecting-a-repository/git-status). This commands displays the state of the working directory and the stage area, that is, it lists which files are staged, unstaged and untracked. Furthermore, it tells you the branch in which you are currently working. You should use this command often, and it is a MUST before doing any commit, to check that the commit is correct. 

...

  1. Use the git rm [file] command to remove the test.py file. Check that the file has been deleted from your working space. 
  2. Use git status to check that the file has been deleted.
  3. Make a new commit to the repository (the rm command updates also the stage area, so do not need to use add this time)

Inspect a repository

  1. )

Inspect a repository

NOTE: INSTRUCTIONS IN THIS SECTION CAN BE DONE ONLY BY ONE MEMBER OF THE TEAM

Many times you want to know who did a change in the code, when the change was made or what is the difference between two file versions. We have three different commands to that end (see the GIT CHEAT SHEET  -> REVIEW HISTORY):

...

  • Q1: Using the log command determine the number of commits and their id (use just the five first digits) from the user named "Marta Cortés".
  • Q2: Using the show command you must determine who, when and how many files were modified in the commit with id starting with 77d79 .
  • Q3: Using the diff command you must determine the changes to the file README.md from the commit with id 4ee6d to the last commit (HEAD).

Working with branches

NOTE: INSTRUCTIONS IN THIS SECTION CAN BE DONE ONLY BY ONE MEMBER OF THE TEAM

The main branch of development is always identified as master. You should not develop new features using master branch, but create a new development branch for each feature you are gonna implement. In this part of the exercise we are learning how to create branches and how to merge them to the master. Please, have a quick look to https://www.atlassian.com/git/tutorials/using-branches  and the GIT CHEAT SHEET -> GROUP CHANGES where you can find more information about three different commands you will use when dealing with branches:

...

Anchor
conflict
conflict
Solving conflicts

NOTE: INSTRUCTIONS IN THIS SECTION CAN BE DONE ONLY BY ONE MEMBER OF THE TEAM

We need to solve the conflicts before we can make a successful merge. To solve a conflict:

...

  1. Run the command git push origin. Origin is the nickname for the server of our remote repository. 
  2. Open your github project and check the number of branches. You should see only one branch (master). Why is that? Because git push origin just pushes the current branch. If you want to push other branch you should do it explicitly:
  3. Run the command git push origin fibonacci in order to push also fibonacci branch. 
  4. Check in your github account that you have now two branches.

NOTE: REST OF INSTRUCTIONS IN THIS SECTION SHOULD BE DONE BY DIFFERENT MEMBERS OF THE TEAM IN DIFFERENT COMPUTERS.

Now that we have a remote repository up to date, we can work in teams. In order to identify two members of the team let's call them Alice and Bob. Alice is the one who has done all recent changes to the repo. Bob is going to start working in the repo now. A second member of the team must take Bob role's in a new computer. In order to start working in the project, Bob needs to create a local copy of the repository in its own computer. But HE IS NOT GOING TO FORK A REPOSITORY, THAT IS, THE REMOTE REPOSITORY IS GOING TO BE THE SAME USED BY ALICE.

...