Tuesday, October 20, 2020

How to control github from gitbash





For this first download the Git windows app. Basically git is a version control system to track the changes made in a project repository. Like who , when and what changes.

to add new files to the already existing repo

1. First tell the git that who are you. Set your user name and user email when you just started working on git. 

git config --global user.name "Vikas Singh'

git config --global user.email "44vikasrajput44@gmail.com"

2. Now you have to create a separate folder by any unique name on your local machine. This is the folder that will contain the changes that you want to make in any repository. But before that, you have to switch to the directory where you want to create a new folder. 

like I want to switch to Downloads folder. 

cd Downloads

3. Create a separate folder by any unique name on your local machine. This is the folder that will contain the changes that you want to make in the repository.

 mkdir mygit

4. Now again switch to mygit folder as we want to do all our work there.

cd mygit


5. Now initialize git. This code will initialize an empty repo in mygit folder

git init 

6. Now make a copy of the repo on which you want to work

git clone repolink

7. Now again switch to the repo

cd reponame

8.Now create a new branch

git branch branchname

9.Now switch to the newly created branch

git checkout branchname

10. Add files to this new branch 

git add filename.txt

ALERT: You can check  the current status of the current repo by this comand below

git status

11. now stage the changes before you commit.

git add filename.txt

12 commit the changes with message

git commit -m "commitmessage"

13.final step is to push the change into Github

git push origin newbranchname

14.by the time you can check your repo status by the above command i told you. or you can check its status by going to the github and there you can create a pull request. 

ALERT: You can check the history of repo by this command.

git log

________________________________________________

git init

use this above command when you start something new!

Make edits using git bash

create a directory on your local machine

switch to that directory

Initialize git with git init

clone /fork the repo in that directory

switch to the repo directory 

create a new branch

switch to the new branch

make the changes

stage  the changes by git add filename

commit the changes 

finally push the changes


0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home