Commandes GIT
git remote show origin
Lokesh003
git remote show origin
git merge --abort
> git add
Moves changes from the working directory to the staging area.
This gives you the opportunity to prepare a snapshot before committing it to the official history.
> git branch
This command is your general-purpose branch administration tool.
It lets you create isolated development environments within a single repository.
> git checkout
In addition to checking out old commits and old file revisions, git checkout is also the means to navigate existing branches.
Combined with the basic Git commands, it’s a way to work on a particular line of development.
> git clean
Removes untracked files from the working directory.
This is the logical counterpart to git reset, which (typically) only operates on tracked files.
> git clone
Creates a copy of an existing Git repository.
Cloning is the most common way for developers to obtain a working copy of a central repository.
> git commit
Takes the staged snapshot and commits it to the project history.
Combined with git add, this defines the basic workflow for all Git users.
> git commit --amend
Passing the --amend flag to git commit lets you amend the most recent commit.
This is very useful when you forget to stage a file or omit important information from the commit message.
> git config
A convenient way to set configuration options for your Git installation.
You’ll typically only need to use this immediately after installing Git on a new development machine.
> git fetch
Fetching downloads a branch from another repository, along with all of its associated commits and files.
But, it does not try to integrate anything into your local repository.
This gives you a chance to inspect changes before merging them with your project.
> git init
Initializes a new Git repository.
If you want to place a project under revision control, this is the first command you need to learn.
> git log
Lets you explore the previous revisions of a project.
It provides several formatting options for displaying committed snapshots.
> git merge
A powerful way to integrate changes from divergent branches.
After forking the project history with git branch, git merge lets you put it back together again.
> git pull
Pulling is the automated version of git fetch.
It downloads a branch from a remote repository, then immediately merges it into the current branch.
This is the Git equivalent of svn update.
> git push
Pushing is the opposite of fetching (with a few caveats).
It lets you move a local branch to another repository, which serves as a convenient way to publish contributions.
This is like svn commit, but it sends a series of commits instead of a single changeset.
> git rebase
Rebasing lets you move branches around, which helps you avoid unnecessary merge commits.
The resulting linear history is often much easier to understand and explore.
> git rebase -i
The -i flag is used to begin an interactive rebasing session.
This provides all the benefits of a normal rebase, but gives you the opportunity to add, edit, or delete commits along the way.
> git reflog
Git keeps track of updates to the tip of branches using a mechanism called reflog.
This allows you to go back to changesets even though they are not referenced by any branch or tag.
> git remote
A convenient tool for administering remote connections.
Instead of passing the full URL to the fetch, pull, and push commands, it lets you use a more meaningful shortcut.
> git reset
Undoes changes to files in the working directory.
Resetting lets you clean up or completely remove changes that have not been pushed to a public repository.
> git revert
Undoes a committed snapshot.
When you discover a faulty commit, reverting is a safe and easy way to completely remove it from the code base.
git config --global credential.helper cache
# Main git commands
# Configurations
git config --global user.name "Sam Smith"
git config --global user.email [email protected]
# New Repository
git init
# Copy local repository
git clone /path/to/repository
# Copy local repository for remote servers
git clone username@host:/path/to/repository
# Add files
git add <filename>
git add *
# Git Commits
git commit -m "Commit message"
# Commit any files added with git add command
git commit -a
# Push changes to master branch
git push origin master
# Check the status of files
git status
# Connect to remote repository
git remote add origin <server>
# Provide a list of recently configured remote repositories
git remote -v
# Create new branch then switch to it
git checkout -b <branchname>
# Switch branches
git checkout <branchname>
#List all branches in repository
git branch
# Delete the feature branch
git branch -d <branchname>
# Push selected branch to your remote repository
git push origin <branchname>
# Push all branches to remote repository
git push --all origin
# Delete a branch on the remote repository
git push origin :<branchname>
# Fetch and merge changes on remote server to certain directory
git pull
# Merge a different branch into active branch
git merge <branchname>
# View merge conflicts
git diff
git diff --base <filename>
git diff <sourcebranch> <targetbranch>
# Mark changed file
git add <filename>
# Utilise tagging to mark a certain changeset
git tag 1.0.0 <commitID>
# Get changeset ID
git log
# Push all tags to remote repository
git push --tags origin
# Undo local changes, replace changes
git checkout -- <filename>
# Drop all changes and commits
git fetch origin
git reset --hard origin/master
# Search the working directory for foo(); (example)
git grep "foo()"
Basic Git commands
https://confluence.atlassian.com/bitbucketserver/basic-git-commands-776639767.html