Answers ( 1 )

  1. 
    1. git clone <repository url>

    This command is used for downloading the latest version of a remote project and copying it to the selected location on the local machine

    2. git checkout

    You can use the checkout command to switch the branch that you are currently working on.

    git checkout <branch name>

    3. git init

    This is the command you need to use if you want to start a new empty repository or to reinitialize an existing one in the project root. It will create a .git directory with its subdirectories. It should look like this:

    git init <repository name>

    4. git commit

    This one is probably the most used Git command. After changes are done locally, you can save them by “committing” them. A commit is like local a snapshot of the current state of the branch, to which you can always come back. To create a new commit, type this command in Git Bash:

    git commit -m "<commit message>"

    5. git push

    Git push will push the locally committed changes to the remote branch. If the branch is already remotely tracked, simply use it like this (with no parameters):

    git push

    6. git add

    This is the command you need to use to stage changed files. You can stage individual files:

    git add <file path>

    Or all files:

    git add .

    7. git branch

    Using git branch will list all the branches of the repository:

    Git Branch

    Or you can use it to create a new branch, without checking it out:

    git branch <new branch>

    To delete a branch, run it like this:

    git branch -d <branch name>

    0 Comment Add Comment/ View

Leave an answer

Logged in as