Git Commands, Master and User Branch, Azure Devops - Yash-777/tortoisesvn GitHub Wiki

Azure DevOps Plan smarter, collaborate better and ship faster with a set of modern dev services.

Repos: Files > MyProjectRepos
       Commits - Check commit status
Pipelines:Pipelines > Recently run pipelines   [Commit Number:777]
         :Releases  > Release-App-Deployment > Create New Relase

Git Basic Commands

$ git config --global http.proxy Proxy_URL.net:9400

Deep Clone the Repository:
If you don't already have a local clone of the repository in question, create one now:
$ git clone remote-url
$ git clone https://[email protected]/GitServices/MyApps/_git/MyApp

$ git checkout Dev

$ git fetch
$ git pull
$ git add .
$ git status
$ git commit -m "commit message"
$ git push

To remove folder/directory only from git repository and not from the local try 3 simple commands.stackoverflow.com

$ git rm -r --cached myFolder

Shrink a Git Repository by removing some files log history from the .git Folder based on their last updated time.

$ git remote prune origin && git repack && git prune-packed && git reflog expire --expire=1.month.ago && git gc --aggressive

Add, Remove, Rename Files

$ git add .
$ git status
$ git commit -m "commit message"
$ git push

Y1777@VDIU1GE00000471 MINGW64 /c/Yash/SVN Branches - Release/Azure Automation/MyApp/Application (Dev)
$ git status
On branch Dev
Your branch is up to date with 'origin/Dev'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        deleted:    20201202_01/DEV/MyApp1.war
		new file:   20200522_01/DEV/test.txt
        renamed:    20201211_01/DEV/MyApp2.war -> 20201228_01/DEV/MyApp2.war
        modified:   ApplicationFolderSelector.txt


Y1777@VDIU1GE00000471 MINGW64 /c/Yash/SVN Branches - Release/Azure Automation/MyApp/Application (Dev)
$ git commit -m "removed some artifacts and added new artifacts"
[Dev 11af656] removed some artifacts and added new artifacts
 Committer: Merugu <[email protected]>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:

    git config --global user.name "Your Name"
    git config --global user.email [email protected]

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 8 files changed, 1 insertion(+), 1 deletion(-)
 delete mode 100644 Application/20201202_01/DEV/MyApp1.war
 create mode 100644 Application/20200522_01/DEV/test.txt
 rename Application/{20201211_01 => 20201228_01}/DEV/MyApp2.war (98%)

Important Git concepts

Here are the basic terms you should familiarize yourself with before embarking on your journey.

  • Repository / Repo: This is the project's source code that resides on github.com's servers. You cannot modify the contents of this repository directly unless you were the one who created it in the first place.

  • Fork: Forking a project will create a copy of the original repository that you can modify as you please. Forked projects will appear in your own github.com account.

  • Cloning: this will clone an online repository to your hard drive so you may begin working on your modifications. This local copy is called your local repository.

  • Branch: A branch is a different version of the same project. In the case of T2DMIT, you will see 2 branches: the master branch and the development branch.

  • Remote: A remote is simply an alias pointing to an online repository. It is much easier to work with such aliases than typing in the complete URL of online repositories every single time.

  • Staging Area: Whenever you want to update your online repository (the one appearing in your github.com account), you first need to add your changes to your staging area. Modifying files locally will not automatically update your staging area's contents.

Important Git commands

  • Fetch: git fetch will download the current state (containing updated and newly created branches) of an online repository without modifying your local repository. It places its results in .git/FETCH_HEAD.

  • Merge: git merge will merge the modifications of another branch into the current working branch.

  • Pull: git pull is actually a combination of git fetch and git merge. It fetches the information from an online repository's branch and merges it with your local copy.

  • Add: Whenever you modify a file in your local repository or create a new file, that file will appear as unstaged. Calling git add allows you to specify files to be added to your staging area.

  • Commit: A commit records a snapshot of your staging area, making it ready to be pushed to an online repository.

  • Push: git push will take all of your locally committed changes and upload them to a remote repository's branch.

Don't worry if these words aren't familiar to you just yet, going through the actual process will (hopefully!) make everything clear.


⚠️ **GitHub.com Fallback** ⚠️