What is GitHub? ===== ====== GitHub is a code hosting platform for version control and collaboration(co-operative). It lets you and others work together on projects from anywhere. Git is a Dstributed version control system. Is Git distributed version control system? ========= ============== =========== Yes, Git is a free, open source distributed version control system tool designed to handle everything from small to very large projects with speed and efficiency. It was created by Linus Torvalds in 2005 to develop Linux Kernel. The Project repositery is mainted in the server and also maintened at developer systems. Each developer systems must contain a git software and github is a server which maintaince server side repositery of a project. Install git software from https://git-scm.com/downloads An exe file is downloaded, install git by double click on that exe file. Admin: ===== The Admin who starts and maintaines the project and the developers who are going to work on that project both must be contain Github accounts. Admin steps : === ====== Admin is the initiator of Project. Admin has to Create a new Project and he should make it this project in a Git Repository and can share this project on Github. Programming Steps by Using PyCharm: ========= ====== Step1:- ===== Create a new Djando project using Pycharm and open it. Step2:- ===== --->> To know which git software is available then do like bellow, Goto File menu ---->> Click on Settings ---->> Click on "Version Control" ---->> Click on "Git" ---->> click on "Test". ---->> This step will Check "Git" software is installed in the system or not. git software location : ---- ------ -------- C:\Programs Files\Git\cmd\git.exe Step3: ===== To activate the Github account creadentials with Pycharm IDE then click on "File" menu ---->> Click on "Settings"---->> Click on "Version Control"--->> Click on "Github" ---->> click on "Add Account" or click on + symbol on top side---->> enter the Github creadentials. ---->> If given creadentials are currect then our Github account name displays on pycharm IDE. Step4:- ====== ---->> Select a directory where a new Git Repository will be created. --->> Click on "VCS" menu on Top headerbar ---->>> click on "Create Git Repository" ---->>> click on "Ok". ---->> share a created repository to the server side like bellow ---->> Click on "git" menu on Top headerbar --->>> click on "Github" menus--->> click on "Share Project on Github". --->> Then we willl get a window like Repository Name : Your Repo name you are getting Remote : origin Description : write Some description here about your Repo Click on "Share" button ---->> you will get all available files with checked marks in that repo for Adding files. click on "Add" button----->> Then you will get reloading process like "pushing to github". Finally we will get message like "Successfully shared project on Github"---->> our project name ( popup box ). step 5 :- ========= ---->> Open the browser and refresh it. then we will get our repository name on github locations. for example, : https://github.com/srinivasrao452/First_Project step 6 ====== ---->> If you want add the README file click on "ADD README" file button. for example : First_Project / README.md or cancel --->> click on "commit new file" location for saving this file. ---->> before if you want change the branch name, then create new branch. otherwise default "master" branch only created. How to import projects from Github into Pycharm :- ============= ====== ===== ***** === ******* Step1:- ===== Click on "VCS" menu on Top headerbar --->>> click on "Check out from Version control" --->>> click on "Github" --->>> Now it is accessing of Github account. --->>> Here we will get one Textbox with Dropdown menu. Git Repository URL : Past clone URL here ---->>> click on "TEST" button.---->> you will get "Connection Ok" --->>> So here we will give the github url from our Github accounts. Goto your Github accounts on broweser--->> Goto Projects Repository folder. Select your projects --->>> click on "Clone or Download" option---->>> Then we will get a URL--->>> Copy that URL --->>> Past it in "Git Repository URL" dropdown menu above. ---->>> click on "Test" button -->> here your URL is Tested sometimes. --->>> finally we are getting "successfully" msg --->> ok. ---->> get a window like , whould you like to open the directory --->> click on "Yes" button. --->>> Open a pycharm of our project ---->>> Right now we are getting only "README.md" file only. How to Pull : ========= click on VCS --->> click on Git---> click on "pull" command --->> open one window like Git Root : location Current Branch : master Remote : origin Branchs to Merge : origin/master -->> click on "pull" button again. --->> successfully you will get updatings. How to Pushing: ====== ===== VCS ---->> Git ---->click on "ADD" . VCS ---->> Git ----->> click on "COMMIT" file---->>> will get window like changes files ---->> click again "commit" button.----->> get info like 1 file commited. VCS ---->>> Git --->> Push--->> get window like with updated files --->> click push button NOTE : ===== If you want to upload your files then we need to do some procedure like 'Add', "Commit" files , and "PUSH" command. If you want to import your files then we need to do some procedure like "PULL" command. ============== Using Pycharm ======== ============= Command Prompt commands ====== ===== ======= Stpe1: - ===== cmd > git init It initialises the git account details. cmd > git clone URL_of_Repo.git copy the url of git repository from server side and past it in client side. then it brings your Repository in to local system . cmd > cd folder_name Change the current Repository folder location. for add/modify/ the files purpose , ==== === cmd > git add . It adds all files which are available in current folder. cmd > git commit -m "First commit" Here we are going to write one String message for representing the comments what we did presently. Note: ==== cmd> git config --global user.email "you@example.com" cmd> git config --global user.name "your name" cmd> git branch --->> to find what is current branch branch1 main *branch2 cmd> git branch --all ---->> to show all local and server side branches cmd> git branch --list ---->> to show all local side branches --->> To create any new branch like bellow, cmd> git branch branchnName ----->>> it is not selectd as current branch. ---->> to select existing branch as current one cmd> git checkout branchnName --->> To create any new branch and selecteing it as current branch cmd> git checkout -b new_branch Switched to a new branch 'new_branch' ---->> To know what is our current branch is cmd> git branch cmd> git branch -l branch1 main * new_branch ---->>> current branch ---->> it is showying only local side brances. --->> To know both local and Remote brances then use like below cmd> git branch --all --->> To change into any existing branch like bellow cmd> git checkout main branch1 newbranch * main ---->> To send local changes code into a sub branch and send this sub branch into server side repository. ---->> here new code changes added into newbranch only but not into main branch --->> to get server side sub branch into local cmd> git fetch --prune --->> to select required sub branch cmd> git checkout newbranch --->> do required changes what we want in local files --->> execute add and commit commands --->> to send code in to required sub branch in server side use push command cmd> git push origin newbranch ---->> to merge newbranch code into current branch in local side cmd> git merge newbranch ---->> now use push commands to send into server side main branch cmd> git push origin main it uploads your latest code into Github server. cmd> git pull it imports your latest code from Github server into your local system. cmd> git remote add origin Url It creates the new Git Repository name on Github account. One URl we are sending like git remote add origin "https:/....../srinivasrao452/MyProject" git push origin main ======================== About Repository ======= ======== A repository is usually used to organize a single project. Repositories can contain folders and files, images, and data sets – anything your project needs. We recommend including a README, or a file with information about your project. GitHub makes it easy to add one at the same time you create your new repository. To create a new repository ======== ============ In the upper right corner, next to your avatar, click and then select New repository. Name your repository "hello-world". Write a short description for Your Repo. Select Initialize this repository with a README. Create a Branch ===== ======= Branching is the way to work on different versions of a repository at one time. By default your repository has one branch named "master" which is considered to be the definitive branch. We use branches to experiment and make edits before committing them to master. When you create a branch off the master branch, you’re making a copy, or snapshot, of master as it was at that point in time. If someone else made changes to the master branch while you were working on your branch, you could pull in those updates. To create a new branch ======= ========= Go to your new repository hello-world. Click the drop down at the top of the file list that says branch: master. Type a branch name, readme-edits, into the new branch text box. Select the blue Create branch box or hit “Enter” on your keyboard. Make and commit changes ====== ============= Click the README.md file. Click the pencil icon in the upper right corner of the file view to edit. In the editor, write a bit about yourself. Write a commit message that describes your changes. Click Commit changes button. Merge your Pull Request ======= ========== In this final step, it’s time to bring your changes together – merging your readme-edits branch into the master branch. Click the green Merge pull request button to merge the changes into master. Click Confirm merge. Go ahead and delete the branch, since its changes have been incorporated, with the Delete branch button in the purple box.