Ad Code

Responsive Advertisement

Github

commands

  • git config

  • $ git config --list
    $ git config --global user.email "user@example.com"
    $ git config --global user.name "user1"
  • remote repository

  • create a new repository on the command line

    $ echo "# reading-list1" >> README.md
    $ git init
    $ git add README.md
    $ git commit -m "first commit"
    $ git remote add origin $ git push -u origin master

    or push an existing repository from the command line

    $ git remote add origin
    $ git push -u origin master
    $ npm install (go to repo1 directory and enter this command)
  • commit-push> Git branch

  • move into another branch

    $ git checkout

    pull

    $ git pull

    commit & push

    $ git commit -am "commit message"
    $ git push
  • …or create a new repository on the command line

  • $ echo "# test" >> README.md
    $ git init
    $ git add README.md
    $ git commit -m "first commit"
    $ git branch -M master
    $ git remote add origin https://github.com/KhantParthkumarA/test.git
    $ git push -u origin master
  • …or push an existing repository from the command line

  • $ git remote remove origin
    $ git remote add origin https://github.com/KhantParthkumarA/test.git
    $ git branch -M master
    $ git push -u origin master
  • Other commands

  • $ git diff --color development feature/FP-1
    $ git merge feature/FP-1 --allow-unrelated-histories
    $ git push origin master -f
    $ git checkout master
    $ git branch main master -f
    $ git checkout main
    $ git push origin main -f

    DELETE BRANCH 
    $ git branch -d {branchName}
    $ git push origin --delete {branchName}

    ReAdd remote branch
    -  
    git fetch --prune

    FETAL ERROR GIT REPO NOT FOUND
    $ git remote set-url origin https://YOUR_GITHUB_USER@gitRemoteUrlwithout-https:// or $ git config --global remote.origin.url "https://YOUR_GITHUB_USER@gitRemoteUrlwithout-https://
    " or UNSET CREDENTIAL incase of worked with diff git user in past $ git config --global --unset credential.helper $ git config --system --unset credential.helper

    GIT SET & UNSET CREDENTIALS ref - https://askubuntu.com/questions/206449/git-config-global-file-remove-settings - git config --global --unset-all user.name
    git config --global --replace-all user.name "New User Name"

Post a Comment

0 Comments

Close Menu