top of page

GitHub services through command prompt

Git Clone

The git clone command is used to create a copy of a specific repository or branch within a repository.Git is a distributed version control system. Maximize the advantages of a full repository on your own machine by cloning.

→open the folder where want to place the project and than open command prompt than Command1.>git clone

Common usages and options for git clone

1.git clone [url]: Clone (download) a repository that already exists on GitHub, including all of the files, branches, and commits.

2.git clone --mirror: Clone a repository but without the ability to edit any of the files. This includes the refs, or branches. You may want to use this if you are trying to create a secondary copy of a repository on a separate remote and you want to match all of the branches. This may occur during configuration using a new remote for your Git hosting, or when using Git during automated testing.

3.git clone --single-branch: Clone only a single branch

4.git clone --sparse: Instead of populating the working directory with all of the files in the current commit recursively, only populate the files present in the root directory. This could help with performance when cloning large repositories with many directories and sub-directories.

5.git clone — recurse-submodules[=<pathspec]: After the clone is created, initialize and clone submodules within based on the provided pathspec. This may be a good option if you are cloning a repository that you know to have submodules, and you will be working with those submodules as dependencies in your local development.

6.git branch: This shows the existing branches in your local repository. You can also use git branch [banch-name] to create a branch from your current location, or git branch --all to see all branches, both the local ones on your machine, and the remote tracking branches stored from the last git pull or git fetch from the remote.

7. git pull: Updates your current local working branch with all new commits from the corresponding remote branch on GitHub. git pull is a combination of git fetch and git merge.

8· git push: Uploads all local branch commits to the remote.

9· git remote -v: Show the associated remote repositories and their stored name, like origin.

10· git commit: This starts the commit process, but since it doesn't include a -m flag for the message, your default text editor will be opened for you to create the commit message. If you haven't configured anything, there's a good chance this will be VI or Vim. (To get out, press esc, then :w, and then Enter. :wink:)

11· git commit -m "descriptive commit message": This starts the commit process, and allows you to include the commit message at the same time.

12· git commit -am "descriptive commit message": In addition to including the commit message, this option allows you to skip the staging phase. The addition of -a will automatically stage any files that are already being tracked by Git (changes to files that you've committed before).

13· git commit --amend: Replaces the most recent commit with a new commit. (More on this later!)

14· git add [file]: Snapshots the file in preparation for versioning, adding it to the staging area.

15· git status: Always a good idea, this command shows you what branch you're on, what files are in the working or staging directory, and any other important information.

16· git push: Uploads all local branch commits to the remote.

17· git log: Browse and inspect the evolution of project files.

18· git reset as Sometimes, a commit includes sensitive information and needs to actually be deleted. git reset is a very powerful command that may cause you to lose work. By resetting, you move the HEAD pointer and the branch pointer to another point in time — maybe making it seem like the commits in between never happened.

19· git reflog as If you’re changing history and undoing commits, you should know about git reflog. If you get into trouble, the reflog could get you out of trouble. The reflog is a log of every commit that HEAD has pointed to. So, for example, if you use git reset and unintentionally lose commits, you can find and access them with git reflog.

32 views0 comments

Recent Posts

See All

Exception Handling in Selenium Webdriver

What is an exception? An exception is an error that occurs during the execution of a program. However, while running a program, programming languages generate an exception that must be handled to prev


Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page