Skip to content

Instantly share code, notes, and snippets.

@Link-God
Last active March 22, 2018 00:16
Show Gist options
  • Save Link-God/72bb85582e849ff8607773524b710170 to your computer and use it in GitHub Desktop.
Save Link-God/72bb85582e849ff8607773524b710170 to your computer and use it in GitHub Desktop.
lab03

Laboratory work III

Данная лабораторная работа посвещена изучению систем контроля версий на примере Git.

$ open https://git-scm.com

Tasks

  • 1. Создать публичный репозиторий с названием lab03 и с лиценцией MIT
  • 2. Ознакомиться со ссылками учебного материала
  • 3. Выполнить инструкцию учебного материала
  • 4. Составить отчет и отправить ссылку личным сообщением в Slack

Tutorial

$ export GITHUB_USERNAME=<имя_пользователя>
$ export GITHUB_EMAIL=<адрес_почтового_ящика>
$ alias edit=<nano|vi|vim|subl>
$ cd ${GITHUB_USERNAME}/workspace
$ source scripts/activate
$ mkdir projects/lab03 && cd projects/lab03
$ git init
$ git config --global user.name ${GITHUB_USERNAME}
$ git config --global user.email ${GITHUB_EMAIL}
$ git config -e --global
$ git remote add origin https://github.com/${GITHUB_USERNAME}/lab03.git
$ git pull origin master
$ touch README.md
$ git status
$ git add README.md
$ git commit -m"added README.md"
$ git push origin master

Добавить на сервисе GitHub в репозитории lab03 файл .gitignore со следующем содержимом:

*build*/
*install*/
*.swp
.idea/
$ git pull origin master
$ git log
$ mkdir sources
$ mkdir include
$ mkdir examples
$ cat > sources/print.cpp <<EOF
#include <print.hpp>

void print(const std::string& text, std::ostream& out) {
  out << text;
}

void print(const std::string& text, std::ofstream& out) {
  out << text;
}
EOF
$ cat > include/print.hpp <<EOF
#include <string>
#include <fstream>
#include <iostream>

void print(const std::string& text, std::ostream& out = std::cout);
void print(const std::string& text, std::ofstream& out);
EOF
$ cat > examples/example1.cpp <<EOF
#include <print.hpp>

int main(int argc, char** argv) {
  print("hello");
}
EOF
$ cat > examples/example2.cpp <<EOF
#include <fstream>
#include <print.hpp>

int main(int argc, char** argv) {
  std::ofstream file("log.txt");
  print(std::string("hello"), file);
}
EOF
$ edit README.md
$ git status
$ git add .
$ git commit -m"added sources"
$ git push origin master

Report

$ cd ~/workspace/labs/
$ export LAB_NUMBER=03
$ git clone https://github.com/tp-labs/lab${LAB_NUMBER}.git tasks/lab${LAB_NUMBER}
$ mkdir reports/lab${LAB_NUMBER}
$ cp tasks/lab${LAB_NUMBER}/README.md reports/lab${LAB_NUMBER}/REPORT.md
$ cd reports/lab${LAB_NUMBER}
$ edit REPORT.md
$ gistup -m "lab${LAB_NUMBER}"

Links

Copyright (c) 2017 Братья Вершинины
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment