Open omarokasha1 opened 2 years ago
Repository
is a storage that keep date organized and a community can access this data.Master
is a main of data .Branch
This is usually used with teams so that there is no conflict in the data (each member in team have own branch and in the end combination them in the master) .init
when you start your first time with git you can add your username with git and email that will be used with push . Add
to add files that are ready to be commited . Commit
(snapshot or checkpoint) is to submit all changes that you do to your added files to be ready to be pushed to your server move it in local repositiory . Status
to check what the file added and not commited.Remote
to connect the local repo and the repo on server .Push
upload local changes to remote.pull
you pull changes from remote repo to your local.pull request
tell other about changes to pull it from local to remote .Clone
copy of the repositiory origin to your local Device .Fetch
copy a branch and save it as a new branch to your device .Git branch
get all branches in your repository.git branch Name
create a new branch with a Name.Checkout
is to move between branches.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]
ssh-add ~/.ssh/id_rsa
sudo apt-get install xclip
xclip -sel clip < ~/.ssh/id_rsa.pub
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>
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>
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>
The Git status command gives us all the necessary information about the current branch.
<command line in git> git status
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 .
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"
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>
The git pull command is used to get updates from the remote repo.
The git pull command is used to get updates from the remote repo.
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/"
cd ~/git/your-repo-root git log
git checkout
.
in the previous line is important!git commit -m "Restoring old source code"
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"
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
create a new branch
There a picture is show how to use git hub :
@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
@mariamyoussefwiliam https://www.youtube.com/watch?v=rgbCcBNZcdQ
Very Important To watch it and share what you learn with all of us tomorrow.
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.
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.
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.
finally you upload your project in github .
git branch <branch-name>
git branch
git checkout BranchName
add git status to know what files not added yet.
add all files
git add *
and git status one more time to get files add but not commit yet.
git status
.
and then add commit
git commit -m "commit message"
finally push your code in your new branch using this commit
git push origin BranchName
It is a learning Experience ,
Keep it Open to keep documenting
git clone git@github.com:omarokasha1/TheFirstProject.git
git branch branchName
Very Important
git checkout branchName
git status
git add .
git commit -m "Your Message"
Before Push Please, checkout to check you on your branch
git push
@omarokasha1 check it please, Thanks.
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`
ssh-keygen -t rsa -b 4096 -C "joe@example.com"
Enter file in which to save the key (/c/Users/karem/.ssh/id_rsa): [Press Enter]
Enter passphrase (empty for no passphrase): [Press Enter]
Enter same passphrase again: [Press Enter]
cat .ssh/id_rsa.pub
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_rsa
@mirette3 Chech it Please, Thanks
FIrst Hour in the day please Do a research on the github and Then make a pulse for 10 Mins