shain-app / backend

1 stars 0 forks source link

Git/Github #2

Closed dimitarstoyanov95 closed 1 month ago

dimitarstoyanov95 commented 1 month ago

Learn the basic concepts of what Git and Github are.

Objectives:

1 - Watch these videos: Git vs. GitHub: What's the difference? Git It? How to use Git and Github

Short tutorial: Git Tutorial For Dummies

2 - Answer the questions bellow in the comment section.

dimitarstoyanov95 commented 1 month ago

Answer these questions by modifying this file and adding your answer bellow the question. Use ChatGPT

  1. What is the difference between Git and Github

  2. What are the basic commands of git to create modify commit and push changes to a branch.

  3. How does git stash work, and in what scenarios would it be useful?

  4. Explain the difference between git fetch and git pull.

Ha-ds commented 1 month ago
  1. Git tracks changes in a file, allows to record revisions, view history, branch, merge and revert code. It is installed on the local machine. Github is used to store repositories online, collaborate on projects and manage pull requests. It is a web platform.
  2. Initialize a Git repository: git init Initialize a Git repository: git clone Check the current status of the repository: git status Stage changes for commit: git add . Commit changes: git commit -m "" Push changes to a remote repository: git push origin branch-name Create a new branch: git checkout -b new-branch-name Switch to an existing branch: git checkout branch-name 3.git stash temporarily saves uncommitted changes without committing them, allowing switching branches or pulling changes without having conflicts. Useful Scenario: when I'm working on sth but I need to switch to another branch to fix a bug
  3. git fetch: Downloads updates from a remote repository, such as GitHub, but does not automatically merge them with your current branch. git pull: Combines both git fetch and git merge in one step. It downloads the changes from the remote repository and automatically merges them into your current branch.

READ AND MARK TICKET AS DONE

Initialize a Git repository: git init // Initializes a directory/file to be used as a repository

Initialize a Git repository: git clone // git clone branch-ssh-key to clone the correct repository from Github

Push changes to a remote repository: git push origin branch-name // git push is used most of the time

Create a new branch: git checkout -b new-branch-name // This is to create and check it out at the same time

  1. git fetch: Downloads updates from a remote repository, such as GitHub, but does not automatically merge them with your current branch. // Used to update your local machine with the latest changes made to the repository