How to Do Coding on Bitbucket Using Visual Studio – Step-by-Step Guide
Step 1: Create a New Project in Visual Studio
- Open Visual Studio.
- Click on “Create a new project”.
- Select Console App (or any project type you want).
Step 2: Open Terminal in Visual Studio
- Go to: View → Terminal (or use Ctrl+`).
- Select Developer Command Prompt from the dropdown.
Step 3: Initialize Local Git Repository
- Type this command in terminal: git init
- This sets up Git in your local project folder.
Step 4: Stage and Commit Files
- Stage all files: git add .
- Commit the changes: git commit -m "Initial commit"
Step 5: Create a Remote Repository on Bitbucket
- Go to [Link] and log in.
- Click “Create Repository”.
- Fill details: Repository name, Workspace, Git ignore (optional)
- Click Create Repository and copy the repository URL.
Step 6: Link Local to Remote Repository
- Add the remote URL: git remote add origin [Link]
- Optional: git pull origin master
- Push to Bitbucket: git push -u origin master
Step 7: Verify on Bitbucket
- Go to Bitbucket website and refresh the repository page.
- You’ll see your project files uploaded there.
Step 8: Make Changes and Track with Visual Studio GUI
- Click Add to Source Control (bottom right).
- Select Git.
- Make a code change (e.g., in [Link]).
- Visual Studio shows a red tick next to modified files.
Step 9: Commit and Push Using Visual Studio (No Terminal Needed)
- Go to Team Explorer → Changes tab.
- Type a commit message (e.g., "Minor changes").
- Click Commit All and Push.
Step 10: Confirm Your Changes on Bitbucket
- Go back to the Bitbucket repo in browser.
- Refresh the page.
- You’ll see: Latest commit time, Commit message, Updated files.
Summary of Commands
Initialize Git: git init
Stage Files: git add .
Commit Files: git commit -m "message"
Link Remote: git remote add origin <URL>
Push Files: git push -u origin master
How You Can Explain This to Others
- Start with real-world example: 'Bitbucket is like Google Drive for code.'
- Visual Studio is your workspace, Bitbucket is your online backup.
- Commands = actions to save/send files
- GUI (Graphical Interface) helps you avoid writing commands every time.