Code Monkey home page Code Monkey logo

github-tutorial's Introduction

Github Tutorial

Trying to do all the github commands to see the result

Git is a powerful version control system used for tracking changes in source code during software development. Here's a list of common Git commands along with explanations and examples:

1. git init

  • Description: Initializes a new Git repository.
  • Example:
    git init

2. git clone

  • Description: Creates a copy of a remote repository on your local machine.
  • Example:
    git clone https://github.com/example/repo.git

3. git add

  • Description: Adds changes in the working directory to the staging area.
  • Example:
    git add file.txt

4. git commit

  • Description: Records changes from the staging area to the repository.
  • Example:
    git commit -m "Commit message"

5. git status

  • Description: Shows the status of changes as untracked, modified, or staged.
  • Example:
    git status

6. git log

  • Description: Displays a log of commits.
  • Example:
    git log

7. git pull

  • Description: Fetches changes from a remote repository and merges them into the current branch.
  • Example:
    git pull origin master

8. git push

  • Description: Uploads local changes to a remote repository.
  • Example:
    git push origin master

9. git branch

  • Description: Lists, creates, or deletes branches.
  • Example:
    git branch
    git branch new-feature

10. git checkout

  • Description: Switches branches or restores working tree files.
  • Example:
    git checkout branch-name

11. git merge

  • Description: Combines changes from different branches.
  • Example:
    git merge feature-branch

12. git remote

  • Description: Manages remote repositories.
  • Example:
    git remote -v

13. git fetch

  • Description: Fetches changes from a remote repository but does not merge them.
  • Example:
    git fetch origin

14. git diff

  • Description: Shows changes between commits, branches, etc.
  • Example:
    git diff

15. git reset

  • Description: Resets the current HEAD to a specified state.
  • Example:
    git reset --hard HEAD~1

16. You want from a branch labs to return to the latest satble version of the master

```bash
# Ensure you are on the labs branch
git checkout labs

# Fetch the latest changes from the remote repository
git fetch origin

# Reset the labs branch to match the master branch
git reset --hard origin/master

# Force-push the changes to the remote repository (be careful with force-push)
git push origin labs --force
```

github-tutorial's People

Contributors

khaouitiabdelhakim avatar

Stargazers

 avatar

Watchers

 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.