Ads Top

how to learn github?

 Git tutorial: Github need to use for the purpose of teamwork. Not for the single person, if you want to save your code on the Github and you want to share anyone then you can do easy with full security because when you create a repository then he asked to you give permission private or public.

 

Need to install git from the download: https://git-scm.com/downloads

 

As your the system requires for the git software.

 

Create New repo: Need to go in the https://github.com/ and create an account as follow his instruction. Now you can be authorized for any modification then go to the top right corner on the site find plus icon (+) and choose “New repository” 

 

Go to the code section and copy HTTPS: path https://github.com/thisisyouraccount/myFirstRepo.git and in your local system create any folder as “firstRepo”. Right-click then you will find “Git Bash Here” and you will found a cmd screen as below: 

 

 

 
  
 

Need to use command “git clone https://github.com/thisisyouraccount/myFirstRepo.git”

 

Then you will need to login window for the connectivity from the remote (github sites) and your local system. Again you will find another login window for the confirmation.

  

You will find clone your folder from the live after then you create any other files as you wish like: index.html then close your “Git Bash Here” add something else.


Now again go to your local system folder and right click and again open “git bash here” and type for the checking status your folder: git status then you will find a new file as “index.html” as below screen.


 
github useful commands:

git clone pasteYOurpath  // for the cloning from the live

 

git status  // for the check git status  modification file status change or not

 

 git add .   // for all file added on the local environment or also we can use “git add -A”

 

git add index.html  // for single file added on the local environment 


git commit -m "basic chagnes add"   // -m mean indicating messages

 

 git push origin main  // main original file

 

git push origin branchname // where you are working now.

 

git branch branchname // For creating a new branch

git branch // how many branches are available in this repo, active branch will be green.

 

git checkout branchname // for the switching branch

git push origin branchname // for the pushing data

 

git rebase main //  need to update code in which branch me ho and take code from the main branch

// after add, commit, push then pull

git rebase --continue // if found any confliction in rebase then need to continue

git rebase --skip // if not found any confliction then skip it

git pull origin barnchname //  all file need to show as the base label so need to use

esc:wq // for the blue text screen exit 
 

git stash // means need to save your code in the local environment

git stash apply // for the return of your saved changes from your local environment 



git branch -m headers // on the same branch need to rename header(branch Name) to headers

git branch -m header headers // Need rename branch available on the other branch  means header to headers

git branch -d header // delete branch use -d and for forceful deletion -D but need to outside for which branch you need to delete...


git fetch --all // pulling all created branches

git fetch <branchname> // for the pulling seprated branch only


git reset HEAD~  // if I have not taken update and add & commit then need this command. Then need to use git stash and then git pull and then git stash apply then check your work done. then need to add commit push


$ git checkout assets/css/style.css  // This means If you have taken updates as pull and not required your live style.css then we need to reverse your local changes then use this command. 


git reset --hard // for the hard reset, it back your old version. The result will be as: HEAD is now at 80f0ss update


git status // for the check what is the current status


git fetch // for fetching your all branches as in your project.


git branch // checking branch how many branches are available now yet. where you are showing you green color means your branch name


git checkout barnchName // you moved now in branchName branch.



No comments:

Copyright Reserved to Anything Learn. Powered by Blogger.