Giter Club home page Giter Club logo

swc-sample-irene's Introduction

swc-sample-irene

Sample project for the git lesson of embl software carpentry course

  • The official git webpage and documentation is in this link

Starting a Git Repository in GitHub

  • Create the repo in GitHub and clone to a local directory

In general:

  • To check the repo settings:
git config -l
  • To set user email and preferences
git config --global user.email [email protected]
git config --global user.name "Irene de Teresa"
git config --global core.editor nano
  • Add, commit:
git add filename
git commit -m "the message"

or, to not have restrictions to message length:

git commit

The basic process is file -> add (which brings to a 'stage') -> commit (adds the version to .git) .git is the directory where the repo will be developed so do not modify

  • To see the history of versons and commits
git log #or
git log --oneline
  • diff is a tool that shows changes between versions and repository copies:
git diff

in stage:

git diff --staged

or between two versions in the local repo:

git diff b856f26 b1f794b

to check changes since some version to the current one:

git diff 9bdd448

to color the changes:

git diff --color-words 9bdd448
  • To undo commits!:
git checkout -- README.md
  • To go back in time:

    First, you have to be in a clean state (commit all changes)

    And then go to the desired working copy, e.g. b856f26:

     git checkout b856f26

    Now the HEAD will be in that point in time

    • Now one can do a branch
     git checkout -b one_sample_branch

Relation local/remote repos

  • To push to a remote repository in GitHub:
git push
  • To pull changes from remote repo
git pull

For collaborations

  • If the other person has already commited changes to the remote repo, you have to first pull those changes and then push:
git pull
# Add a message to explain why you will pull
git push
  • When both change the same piece of the repository, the merging can't be done automatically. In the corresponding file one sees the <<<<<<< >>>>>>> symbols and tokens related to the different versions. So one has to edit manually and decide what to chose:
nano conflicting_file_name

then delete weird symbols and choose...

git add ...
git commit ...
git push
  • To protect the repository from potential changes by collaborators: in github -> settings -> branches ...

Branching:

  • new branch
git checkout -b whateverbranchname

Local repositories and GitHub

  • Create a repo locally:
mkdir repo_directory
cd repo_directory
git init
git remote add origin https://github.com/username/new-repo
git pull https://github.com/username/new-repo
git push https://github.com/username/new-repo

Quick markdown overview

  • For bullets, use a small '-'
  • Create bold text use '**'
  • Create emphasized text use '*'
  • Code formatting with backticks
  • For links one uses 'link name'

Good practices in git

  • The commit message should be descriptive

swc-sample-irene's People

Contributors

irenedet avatar holli25 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.