Some useful GIT commands
This clones the entire remote branch into the local computer.
Remember the git URL should be the one that is ending with. git and DIR_NAME is
the directory in the local computer where you want to clone the repository. If
you don’t specify the DIR_NAME, the default location will be the %USER%
directory
This will add the remote git URL value in the local
git configurations so that files can be pushed and pulled from the remote
repository.
· git status
This command will show the set of activities that have
taken place since the last checkout. This includes the set of files that have
changed, the set of files that are staged for commit and that are not staged
for commit, the files that are modified and so on.
· git add ITEM
This command will add the files for commit. This can
be files, folders
There are many variations of using this command if you
want to add files in bulk
git add -A
stages ALL the files
git add .
stages new and modified, WITHOUT DELETED
git add -u
stages modified and deleted, WITHOUT NEW
· git commit -m "Some message"
This command will commit the files with a commit
message
· git remote -v
This command will show the show the remote repository
URL
· git push --set-upstream origin BRANCH_NAME
This command will push the committed files to the
remote repository
· git pull origin BRANCH_NAME
This command will pull any changes from the remote
repository.
· git init
This command will initialize a GIT repository in the
local machine
· git remote rm BRANCH_NAME
This command will remove a branch from the remote
repository
· git merge BRANCH_NAME
If you want to merge a branch2 with branch1, use this
command. The steps will be
git checkout branch1
git merge branch2
To delete a local branch - git branch -d branch_name
Comments
Post a Comment