omarokasha1 / TheFirstProject

This is a Learning Management System Solutions Developed from Scratch inside Orange Digital Center Labs By ODC-Flutter WorkForce.
https://www.orangedigitalcenters.com/country/EG/home
10 stars 6 forks source link

Learning Process : Using Github #1

Open omarokasha1 opened 2 years ago

omarokasha1 commented 2 years ago

FIrst Hour in the day please Do a research on the github and Then make a pulse for 10 Mins

omarokasha1 commented 2 years ago
mariamyoussefwiliam commented 2 years ago

what is git and github?

Before using GIT we need to understand some Definitions :

image

this is all stages

Important Notes:

  • create repo for every project.
  • create a new branch for every feature or enhancement .
  • no need to connect to remote when working.
  • anyone can push and pull depend on permissions. Note: There are two ways to communicate with your repository with HTTP or SSH I find that ssh is the famous one so I decided to use it . As there are communication that going to happen between two devices so we need to set up the communication between them and make it authorized .So we need to generate a RSA code that the protocol that ssh use for Communicating
ssh-keygen -t rsa -b 4096 -C "your_email@example.com" 

Enter a file in which to save the key (/home/you/.ssh/id_rsa): [Press enter]

Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]

so to add the code to our ssh protocol on our Ubuntu

ssh-add ~/.ssh/id_rsa

to Get a copy from the RSA code to add to my gitlab server side We need to install

sudo apt-get install xclip

to take a copy to your clipboard

xclip -sel clip < ~/.ssh/id_rsa.pub

Commands Usually Used in Git

1. Git clone

Git clone makes an identical copy of the latest version of a project in a repository and saves it to your computer.

 <command line in git>   git clone <https://name-of-the-repository-link>

2. Git branch

By using branches, several developers are able to work in parallel on the same project simultaneously.

<command line in git>  git branch <branch-name>
      This command will create a branch locally. To push the new branch into the remote repository, you need to use the following command:

      git push -u <remote> <branch-name>
a-Viewing branches: <command> git branch
b-Deleting a branch: <command> git branch -d <branch-name>

3. Git checkout

 To work in a branch, first you need to switch to it. We use git checkout mostly for switching from one branch to another.
<command line in git>   git checkout <name-of-your-branch>

4. Git status

The Git status command gives us all the necessary information about the current branch.
<command line in git>   git status

5. Git add

We need to use the git add command to include the changes of a file(s) into our next commit.
<command line in git>   git add .

6. Git commit

Git commit is like setting a checkpoint in the development process which you can go back to later if needed.(Move files from stage to repo in a local )
<command line in git>   git commit -m "commit message"

7. Git push

After committing your changes, the next thing you want to do is send your changes to the remote server. Git push uploads your commits to the remote repository.
<command line in git>   git push <remote> <branch-name>

8. Git pull

The git pull command is used to get updates from the remote repo. git pull

9. Git merge

The git pull command is used to get updates from the remote repo. git pull

First you should switch to the dev branch:
<command line in git>  git checkout dev

Before merging, you should update your local dev branch:
<command line in git> git fetch

Finally, you can merge your feature branch into dev:
git merge <branch-name>

source Link "https://www.freecodecamp.org/news/10-important-git-commands-that-every-developer-should-know/"

How to restore old versions ?

cd ~/git/your-repo-root git log

find the commit id you want

git checkout .

IMPORTANT NOTE: the trailing . in the previous line is important!

git commit -m "Restoring old source code"

How to Compare files ?

Using  <command line in git> (git diff ) without any arguments: will compare each modified files in your file system against the files in the current checked-out branch (or) tag.

Using  <command line in git> (git diff <tag(or)branch name>):  will compare each modified files in your file system against the files in the specified branch (or) tag without using checked-out branch (or) tag.

Using <command line in git> (git diff <path/to/file_name (or) path/to/folder>): will compare the specified file or files in the folder in your file system against the current checked-out branch (or) tag.

Using  <command line in git> (git diff <tag1(or)branch1 name> <tag2(or)branch2 name>:  will compare all modified files between two branches / tags.

source Link "https://stackoverflow.com/questions/10988757/git-compare-files-before-commit"

How to merge with Master ?

1. //pull the latest changes of current development branch if any
<command line in git>  git pull (current development branch)

2. //switch to master branch
<command line in git>  git checkout master

3. //pull all the changes if any
<command line in git>  git pull

4. //Now merge development into master
 <command line in git> git merge development

5. //push the master branch
<command line in git>  git push origin master

What is the Normal Process to start working on a new Feature ?

create a new branch git branch

steps

Ka8eemHelmy commented 2 years ago

There a picture is show how to use git hub :

rsxblm88vf231

omarokasha1 commented 2 years ago

@mariamyoussefwiliam and @mirette3 Where is the Edits and Updates ?

As I said to @omda07 It is Urgent to Document We need to document all Features and Process we are handling as This is More Important that Development .

Please @mariamyoussefwiliam Take your Time In Documentation Even if you will stop development for While .

@mirette3 Please Follow Up on that

omarokasha1 commented 2 years ago

@mariamyoussefwiliam https://www.youtube.com/watch?v=rgbCcBNZcdQ

Very Important To watch it and share what you learn with all of us tomorrow.

mariamyoussefwiliam commented 2 years ago

pull requests

Pull requests let you tell others about changes you've pushed to a branch in a repository on GitHub. Once a pull request is opened, you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the base branch.

Steps

mariamyoussefwiliam commented 2 years ago

GitHub Actions

Automate, customize, and execute your software development workflows right in your repository with GitHub Actions. You can discover, create, and share actions to perform any job you'd like, and combine actions in a completely customized workflow.

Video Link "https://www.youtube.com/watch?v=cP0I9w2coGU&t=161s"

omarokasha1 commented 2 years ago

Hey Mariam ,

We need to have Tutorials for :

1) How to work in each Branch ? git branch steps checkout master. git checkout master update master. git pull --rebase origin create branch. git branch branch-name coding. code..... commit. git commit -m "commit name" checkout master. git checkout master update master. git pull --rebase origin checkout local branch. git checkout branchName merge. git merge push. git push

This is still not clear we need to understand what is each line do ?

2) How to Merge Branches ? 3) How to Use Diff and Fetch ?

To make a tutorial by Making an Example like simulate task and how to do it step by step.

mariamyoussefwiliam commented 2 years ago

first how work git in Android Studio

image image image

if you do not have git in your pc

mariamyoussefwiliam commented 2 years ago

Next How to work in each Branch ?

image

and create a new file if you want

image image

if you want merge this branch in master

mariamyoussefwiliam commented 2 years ago

first how work git in Android Studio

image image image

if you do not have git in your pc

omarokasha1 commented 2 years ago

It is a learning Experience ,

Keep it Open to keep documenting

Ka8eemHelmy commented 2 years ago
youssefelgebaly commented 2 years ago

Great job mariam, the word repo was mentioned many times and i couldn't understand what is it. please add an explanation of what is origin. noting wasn't mentioned about of 'Diff`

Ka8eemHelmy commented 2 years ago

How to Add SSH in Windows

cat .ssh/id_rsa.pub
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_rsa

@mirette3 Chech it Please, Thanks