If you are on a remote branch(called feature-branch) cloned from a Golden Repository(golden_repo_name), then here's the technique to squash your commits into one:

1. Checkout the golden repo

   git checkout golden_repo_name

2. Create a new branch from it(golden repo) as follows

   git checkout -b dev-branch

3. Squash merge with your local branch that you have already

   git merge --squash feature-branch

4. Commit your changes (this will be the only commit that goes in dev-branch)

   git commit -m "My feature complete"

5. Push the branch to your local repository

   git push origin dev-branch