Skip to content

Latest commit

 

History

History
149 lines (126 loc) · 4.81 KB

README.md

File metadata and controls

149 lines (126 loc) · 4.81 KB

Linux-and-Git-Tutorial

This is a tutorial that aims to assist in understanding some basic commands on linux and git.

Linux Commands:

The commands that we are going to cover on this tutorial are the following:

  • man   [An interface to the on-line reference manuals] Should be used along side --help in order to better understand a command.
  • pwd   [Prints the full filename of the current working directory.]
  • ls (-l)   [List information about the files (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.]
  • cd   [Navigates to the specified directory.]
  • mkdir   [Create the directory(ies), if they do not already exist.]
  • rm   [Removes files or directories.]
  • cp   [Copies files and directories.]
  • mv   [Moves, renames files.]
  • nano, vi, gedit   [Creates files and edits them, nano and vi are on terminal editors while using another editor such as gedit will open that editor.]
  • touch   [Similar with the other editors although is mostly used to change file timestamps.]
  • chmod   [Change the file mod bits.]
  • grep   [Prints lines matching a pattern.]
  • dolphin ./   [Depending on the operating system the appropriate explorer must be used.]
  • sudo [Allows a permitted user to execute a command as the superuser or another user.]
  • apt-get
    • update
    • upgrade
    • pugre
  • apt-cache search
  • ssh   [OpenSSH SSH client for remote login]
  • scp   [Secure copy for remote file copy]
  • zip, unzip
  • ifconfig   [Configures a network interface, also prints network information.]
  • uname   [Prints system information.]
  • ping   [Sends ICMP ECHO_REQUEST to network hosts and provides info regards the jumps.]

Git requirements

Git is a version control service that allows us to work on our projects with a use of handy tools such as:

  • Versioning along with history.

  • Branching

  • Stashing

  • Even distributing of a release.

  • Git Bash installation

$ sudo apt install git-all
  • In order for the example program to run python must be installed.
$ python3 --version //In order to check if we already have a version installed.
$ sudo apt-get update
$ sudo apt-get install python3.6
  • Git clients
wget https://release.gitkraken.com/linux/gitkraken-amd64.deb
dpkg -i gitkraken-amd64.deb

Git Commands

Git global setup:

$ git config --global user.name "User Name"
$ git config --global user.email "[email protected]"

Can check it by using:

$ git config --list

Create a new repository:

$ git clone [email protected]:UserName/linux-git-tutorial.git
$ cd linux-git-tutorial
$ touch README.md
$ git add README.md
$ git commit -m "add README"
$ git push -u origin master

Existing folder:

$ cd existing_folder
$ git init
$ git remote add origin [email protected]:UserName//linux-git-tutorial.git
$ git add .
$ git commit -m "Initial commit"
$ git push -u origin master

Existing Git repository:

$ cd existing_repo
$ git remote rename origin old-origin
$ git remote add origin [email protected]:UserName//linux-git-tutorial.git
$ git push -u origin --all
$ git push -u origin --tags

Create a new commit and push it to branch master:

$ git add .
$ git commit -m "New commit message."
$ git push -u origin master

Fetch any changes from master in order to merge them after:

$ git fetch
$ git merge

Pull any changes from master:

$ git pull

Different Version Control repository management services

Different Version Control Clients.

Useful links

For Linux

For Git

For Git Kraken