Post

Github

Github

Github

A project in local system which is not a repo in GitHub

1
git int

intializes an empty git repository

1
git add .

add the files to staging area

1
git commit -m "message"
1
git push

this creates a master branch in local system

  • now create a repo in the github/gitlab
1
git remote add origin XXXXXX
  • Upstream branch error - this means that the repo is and the local project are connected but the branch is not configured

Branches

  • master branch = main branch
    1
    
    git branch
    

    shows the available branches

1
git pull 

update the new branches

1
git checkout <branchname>

the the present branch that you are working

1
git checkout -b <branchname>

creates a branch locally and checkouts to that branch

1
git push -u orgin <branchname>  

Deleting a branch

1
git branch -d <branchname>

deletes a branch locally

git rebase

1
git pull -r

this command helps in not commiting the merge request so that the commit history deos not have the record of that merge which helps inn the floe of the dev environment.

Changing branch without committing the local changes

1
git stash
1
git pop
This post is licensed under CC BY 4.0 by the author.