Giter Site home page Giter Site logo

git_tutorial's Introduction

"How to start using git"

  • Mona Parizadeh
  • November 2017

Git info

  • git --version
  • git --help

Configuration:

  • git config --global user.name “username”
  • git config --global user.email “[email protected]
  • git config color.ui "auto"
  • git config core.editor "nano -w"
  • git remote set-url origin http://github.com/username/
  • git config --list

Initiation (in bash)

  • git init Myproject #iniates and creates a new repository
  • cd MyProject
  • touch file.txt
  • ls
  • rm file.txt
  • ls #shows empty
  • rmdir MyProject #not empty!!
  • ls -a #shows hidden files
  • rm -rf .git #remove hidden files
  • cd ..
  • rmdir MyProject #done

R-project

  • Open new project in R_projects ( )
  • Open new file in R_projects (phyllosphere) and write down somthing in the file:
  • phy = read.table("~/Phyllosphere.txt")

Commiting (in bash)

  • git status
  • git add -A #adds all files to the git, these are not permanant yet and need to be commited
  • git commit -m "start Microbiome project"

Sending to the remote server

Pull file from the remote server

  • create new file on github (Protocol)
  • git pull origin master #to receive all the modifications other than local

Undo

  • nano methods : add "qPCR" and save
  • git checkout methods #to erase what hasn't being commited yet

Create new branch: no interruption with the same files on the master branch

  • git checkout -b newBranch #switches to the new branch
  • nano file(Protocol): make a change, save, add, commit:
  • git add Protocol
  • git commit -m "message"
  • git checkout master #switches to branch master #no changes yet in the branch master

Merge newBranch and branch master

  • git merge newBranch/file file #to merge files, no need to commit again, only send to the remote server (push):
  • git push origin master
  • git branch -d newBranch #to delete the newBranch

Merge two modifications on the same file

  • modify the remote and local file(Protocol) in 2 different ways
  • git add Protocol
  • git commit -m "message"
  • git pull origin master #merge conflict
  • git fetch origin #to update the remote server
  • git push origin master #rejected
  • git diff #shows the conflict
  • git merge #not possible and need to be fixed
  • open file(less Protocol) #kept both modifications
  • edit file(nano Protocol), save
  • git add Protocol
  • git commit -m "message"
  • git push origin master

Project Info

  • git log #prints all the changes (when, who, what)

git_tutorial's People

Contributors

memoll avatar

Watchers

 avatar  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.